summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2017-01-04 17:37:19 +0100
committerSubv <subv2112@gmail.com>2017-01-05 15:40:15 +0100
commit7f1dca8cd26fe9be0080efee4e456630960af459 (patch)
tree5eae30d01e21d54e529a1074bbc5cbf3cde8ff6a /src/core/hle/kernel
parentKernel: Remove Thread::wait_objects_index and use wait_objects to hold all the objects that a thread is waiting on. (diff)
downloadyuzu-7f1dca8cd26fe9be0080efee4e456630960af459.tar
yuzu-7f1dca8cd26fe9be0080efee4e456630960af459.tar.gz
yuzu-7f1dca8cd26fe9be0080efee4e456630960af459.tar.bz2
yuzu-7f1dca8cd26fe9be0080efee4e456630960af459.tar.lz
yuzu-7f1dca8cd26fe9be0080efee4e456630960af459.tar.xz
yuzu-7f1dca8cd26fe9be0080efee4e456630960af459.tar.zst
yuzu-7f1dca8cd26fe9be0080efee4e456630960af459.zip
Diffstat (limited to 'src/core/hle/kernel')
-rw-r--r--src/core/hle/kernel/kernel.cpp22
1 files changed, 4 insertions, 18 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp
index 955f50a9b..47d4df69c 100644
--- a/src/core/hle/kernel/kernel.cpp
+++ b/src/core/hle/kernel/kernel.cpp
@@ -32,19 +32,6 @@ void WaitObject::RemoveWaitingThread(Thread* thread) {
}
SharedPtr<Thread> WaitObject::GetHighestPriorityReadyThread() {
- // Remove the threads that are ready or already running from our waitlist
- auto to_remove = waiting_threads.end();
- do {
- to_remove = std::find_if(waiting_threads.begin(), waiting_threads.end(),
- [](const SharedPtr<Thread>& thread) {
- return thread->status == THREADSTATUS_RUNNING ||
- thread->status == THREADSTATUS_READY ||
- thread->status == THREADSTATUS_DEAD;
- });
- // Call RemoveWaitingThread so that child classes can override the behavior.
- RemoveWaitingThread(to_remove->get());
- } while (to_remove != waiting_threads.end());
-
Thread* candidate = nullptr;
s32 candidate_priority = THREADPRIO_LOWEST + 1;
@@ -86,17 +73,16 @@ void WaitObject::WakeupAllWaitingThreads() {
} else {
for (auto& object : thread->wait_objects) {
object->Acquire(thread.get());
- object->RemoveWaitingThread(thread.get());
}
// Note: This case doesn't update the output index of WaitSynchronizationN.
- // Clear the thread's waitlist
- thread->wait_objects.clear();
}
+ for (auto& object : thread->wait_objects)
+ object->RemoveWaitingThread(thread.get());
+ thread->wait_objects.clear();
+
thread->SetWaitSynchronizationResult(RESULT_SUCCESS);
thread->ResumeFromWait();
- // Note: Removing the thread from the object's waitlist will be
- // done by GetHighestPriorityReadyThread.
}
}