aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei <bunneidev@gmail.com>2015-07-21 12:11:48 -0400
committerGravatar bunnei <bunneidev@gmail.com>2015-07-21 12:11:48 -0400
commitdcc8f1bef2035c77f06de5af0decbe62e4301b55 (patch)
treefc382bb2146605e300c48820a6a5e546994b44aa /src
parentaa6dfdb827cd5887db6aeb992ef992a7aa23f766 (diff)
parent275aaeef9c94db25a4a52cfcda1dac0dcc9e6c06 (diff)
Merge pull request #957 from Subv/hwtest_crash
Kernel/Scheduling: Clean up a thread's wait_objects when its scheduled.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/thread.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index 64166ab9..8b49fc7d 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -217,6 +217,14 @@ static void SwitchContext(Thread* new_thread) {
new_thread->context.pc -= thumb_mode ? 2 : 4;
}
+ // Clean up the thread's wait_objects, they'll be restored if needed during
+ // the svcWaitSynchronization call
+ for (int i = 0; i < new_thread->wait_objects.size(); ++i) {
+ SharedPtr<WaitObject> object = new_thread->wait_objects[i];
+ object->RemoveWaitingThread(new_thread);
+ }
+ new_thread->wait_objects.clear();
+
ready_queue.remove(new_thread->current_priority, new_thread);
new_thread->status = THREADSTATUS_RUNNING;