summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/kernel.cpp
diff options
context:
space:
mode:
authorGravatar Subv2016-12-04 09:58:36 -0500
committerGravatar Subv2016-12-04 09:58:36 -0500
commitbdad00c73f46106ba78995bdde1b50349e940b09 (patch)
tree1c39ab11c8e995f2cbba8a5f602ab64819085b22 /src/core/hle/kernel/kernel.cpp
parentThreading: Reworked the way our scheduler works. (diff)
downloadyuzu-bdad00c73f46106ba78995bdde1b50349e940b09.tar.gz
yuzu-bdad00c73f46106ba78995bdde1b50349e940b09.tar.xz
yuzu-bdad00c73f46106ba78995bdde1b50349e940b09.zip
Threading: Added some utility functions and const correctness.
Diffstat (limited to 'src/core/hle/kernel/kernel.cpp')
-rw-r--r--src/core/hle/kernel/kernel.cpp13
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
34SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() { 34SharedPtr<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)