diff options
| author | 2016-12-10 13:29:31 -0500 | |
|---|---|---|
| committer | 2016-12-10 13:29:31 -0500 | |
| commit | 406907d57055965780e04769482556995de8c50a (patch) | |
| tree | f9e355eccba394047b32160e8f7574a74f46772b /src/core/hle/kernel/kernel.cpp | |
| parent | WaitSynch: Removed unused variables and reduced SharedPtr copies. (diff) | |
| download | yuzu-406907d57055965780e04769482556995de8c50a.tar.gz yuzu-406907d57055965780e04769482556995de8c50a.tar.xz yuzu-406907d57055965780e04769482556995de8c50a.zip | |
Properly remove a thread from its wait_objects' waitlist when it is awoken by a timeout.
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 653697843..2ddeffcdd 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -38,6 +38,11 @@ SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() { | |||
| 38 | return thread->status == THREADSTATUS_RUNNING || thread->status == THREADSTATUS_READY; | 38 | return thread->status == THREADSTATUS_RUNNING || thread->status == THREADSTATUS_READY; |
| 39 | }); | 39 | }); |
| 40 | 40 | ||
| 41 | // TODO(Subv): This call should be performed inside the loop below to check if an object can be | ||
| 42 | // acquired by a particular thread. This is useful for things like recursive locking of Mutexes. | ||
| 43 | if (ShouldWait()) | ||
| 44 | return nullptr; | ||
| 45 | |||
| 41 | Thread* candidate = nullptr; | 46 | Thread* candidate = nullptr; |
| 42 | s32 candidate_priority = THREADPRIO_LOWEST + 1; | 47 | s32 candidate_priority = THREADPRIO_LOWEST + 1; |
| 43 | 48 | ||
| @@ -67,7 +72,7 @@ void WaitObject::WakeupAllWaitingThreads() { | |||
| 67 | thread->wait_set_output = false; | 72 | thread->wait_set_output = false; |
| 68 | } | 73 | } |
| 69 | } else { | 74 | } else { |
| 70 | for (auto object : thread->wait_objects) { | 75 | for (auto& object : thread->wait_objects) { |
| 71 | object->Acquire(); | 76 | object->Acquire(); |
| 72 | object->RemoveWaitingThread(thread.get()); | 77 | object->RemoveWaitingThread(thread.get()); |
| 73 | } | 78 | } |