Jelajahi Sumber

Merge pull request #1869 from wwylele/dont-be-lazy

Switch context to the same thread if necessary
Yuri Kunde Schlesner 10 tahun lalu
induk
melakukan
de79b6fc48
1 mengubah file dengan 6 tambahan dan 2 penghapusan
  1. 6 2
      src/core/hle/kernel/thread.cpp

+ 6 - 2
src/core/hle/kernel/thread.cpp

@@ -591,8 +591,12 @@ void Reschedule() {
 
 
     HLE::DoneRescheduling();
     HLE::DoneRescheduling();
 
 
-    // Don't bother switching to the same thread
-    if (next == cur)
+    // Don't bother switching to the same thread.
+    // But if the thread was waiting on objects, we still need to switch it
+    // to perform PC modification, change state to RUNNING, etc.
+    // This occurs in the case when an object the thread is waiting on immediately wakes up
+    // the current thread before Reschedule() is called.
+    if (next == cur && (next == nullptr || next->waitsynch_waited == false))
         return;
         return;
 
 
     if (cur && next) {
     if (cur && next) {