diff options
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 16babe71a..fb1751860 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -50,11 +50,11 @@ void Thread::Stop() { | |||
| 50 | { | 50 | { |
| 51 | SchedulerLock lock(kernel); | 51 | SchedulerLock lock(kernel); |
| 52 | // Cancel any outstanding wakeup events for this thread | 52 | // Cancel any outstanding wakeup events for this thread |
| 53 | Signal(); | ||
| 54 | Core::System::GetInstance().CoreTiming().UnscheduleEvent( | 53 | Core::System::GetInstance().CoreTiming().UnscheduleEvent( |
| 55 | kernel.ThreadWakeupCallbackEventType(), global_handle); | 54 | kernel.ThreadWakeupCallbackEventType(), global_handle); |
| 56 | kernel.GlobalHandleTable().Close(global_handle); | ||
| 57 | SetStatus(ThreadStatus::Dead); | 55 | SetStatus(ThreadStatus::Dead); |
| 56 | Signal(); | ||
| 57 | kernel.GlobalHandleTable().Close(global_handle); | ||
| 58 | 58 | ||
| 59 | owner_process->UnregisterThread(this); | 59 | owner_process->UnregisterThread(this); |
| 60 | 60 | ||
| @@ -81,7 +81,6 @@ void Thread::CancelWakeupTimer() { | |||
| 81 | } | 81 | } |
| 82 | 82 | ||
| 83 | void Thread::ResumeFromWait() { | 83 | void Thread::ResumeFromWait() { |
| 84 | ASSERT_MSG(wait_objects.empty(), "Thread is waking up while waiting for objects"); | ||
| 85 | SchedulerLock lock(kernel); | 84 | SchedulerLock lock(kernel); |
| 86 | switch (status) { | 85 | switch (status) { |
| 87 | case ThreadStatus::Paused: | 86 | case ThreadStatus::Paused: |
| @@ -219,7 +218,7 @@ ResultVal<std::shared_ptr<Thread>> Thread::Create(Core::System& system, ThreadTy | |||
| 219 | thread->processor_id = processor_id; | 218 | thread->processor_id = processor_id; |
| 220 | thread->ideal_core = processor_id; | 219 | thread->ideal_core = processor_id; |
| 221 | thread->affinity_mask = 1ULL << processor_id; | 220 | thread->affinity_mask = 1ULL << processor_id; |
| 222 | thread->wait_objects.clear(); | 221 | thread->wait_objects = nullptr; |
| 223 | thread->mutex_wait_address = 0; | 222 | thread->mutex_wait_address = 0; |
| 224 | thread->condvar_wait_address = 0; | 223 | thread->condvar_wait_address = 0; |
| 225 | thread->wait_handle = 0; | 224 | thread->wait_handle = 0; |
| @@ -272,9 +271,9 @@ void Thread::SetSynchronizationResults(SynchronizationObject* object, ResultCode | |||
| 272 | } | 271 | } |
| 273 | 272 | ||
| 274 | s32 Thread::GetSynchronizationObjectIndex(std::shared_ptr<SynchronizationObject> object) const { | 273 | s32 Thread::GetSynchronizationObjectIndex(std::shared_ptr<SynchronizationObject> object) const { |
| 275 | ASSERT_MSG(!wait_objects.empty(), "Thread is not waiting for anything"); | 274 | ASSERT_MSG(!wait_objects->empty(), "Thread is not waiting for anything"); |
| 276 | const auto match = std::find(wait_objects.rbegin(), wait_objects.rend(), object); | 275 | const auto match = std::find(wait_objects->rbegin(), wait_objects->rend(), object); |
| 277 | return static_cast<s32>(std::distance(match, wait_objects.rend()) - 1); | 276 | return static_cast<s32>(std::distance(match, wait_objects->rend()) - 1); |
| 278 | } | 277 | } |
| 279 | 278 | ||
| 280 | VAddr Thread::GetCommandBufferAddress() const { | 279 | VAddr Thread::GetCommandBufferAddress() const { |
| @@ -389,7 +388,7 @@ void Thread::UpdatePriority() { | |||
| 389 | } | 388 | } |
| 390 | 389 | ||
| 391 | bool Thread::AllSynchronizationObjectsReady() const { | 390 | bool Thread::AllSynchronizationObjectsReady() const { |
| 392 | return std::none_of(wait_objects.begin(), wait_objects.end(), | 391 | return std::none_of(wait_objects->begin(), wait_objects->end(), |
| 393 | [this](const std::shared_ptr<SynchronizationObject>& object) { | 392 | [this](const std::shared_ptr<SynchronizationObject>& object) { |
| 394 | return object->ShouldWait(this); | 393 | return object->ShouldWait(this); |
| 395 | }); | 394 | }); |