diff options
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index be7a5a6d8..6d358def7 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -33,7 +33,7 @@ void WaitObject::RemoveWaitingThread(Thread* thread) { | |||
| 33 | 33 | ||
| 34 | SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() { | 34 | SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() { |
| 35 | // Remove the threads that are ready or already running from our waitlist | 35 | // Remove the threads that are ready or already running from our waitlist |
| 36 | waiting_threads.erase(std::remove_if(waiting_threads.begin(), waiting_threads.end(), [](SharedPtr<Thread> thread) -> bool { | 36 | waiting_threads.erase(std::remove_if(waiting_threads.begin(), waiting_threads.end(), [](const SharedPtr<Thread>& thread) -> bool { |
| 37 | return thread->status == THREADSTATUS_RUNNING || thread->status == THREADSTATUS_READY; | 37 | return thread->status == THREADSTATUS_RUNNING || thread->status == THREADSTATUS_READY; |
| 38 | }), waiting_threads.end()); | 38 | }), waiting_threads.end()); |
| 39 | 39 | ||
| @@ -42,12 +42,11 @@ SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() { | |||
| 42 | 42 | ||
| 43 | auto candidate_threads = waiting_threads; | 43 | auto candidate_threads = waiting_threads; |
| 44 | 44 | ||
| 45 | // Eliminate all threads that are waiting on more than one object, and not all of them are ready | 45 | // Eliminate all threads that are waiting on more than one object, and not all of said objects are ready |
| 46 | candidate_threads.erase(std::remove_if(candidate_threads.begin(), candidate_threads.end(), [](SharedPtr<Thread> thread) -> bool { | 46 | candidate_threads.erase(std::remove_if(candidate_threads.begin(), candidate_threads.end(), [](const SharedPtr<Thread>& thread) -> bool { |
| 47 | for (auto object : thread->wait_objects) | 47 | return std::any_of(thread->wait_objects.begin(), thread->wait_objects.end(), [](const SharedPtr<WaitObject>& object) -> bool { |
| 48 | if (object->ShouldWait()) | 48 | return object->ShouldWait(); |
| 49 | return true; | 49 | }); |
| 50 | return false; | ||
| 51 | }), candidate_threads.end()); | 50 | }), candidate_threads.end()); |
| 52 | 51 | ||
| 53 | // Return the thread with the lowest priority value (The one with the highest priority) | 52 | // Return the thread with the lowest priority value (The one with the highest priority) |