Skip to content
Snippets Groups Projects
Commit 3a338d92 authored by Subv's avatar Subv
Browse files

CPU/HLE: Lock the HLE mutex before performing a reschedule.

Another thread might be in the middle of an SVC, thus altering the state of the schedulers.
parent 84b542c3
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "core/core_timing.h" #include "core/core_timing.h"
#include "core/hle/kernel/scheduler.h" #include "core/hle/kernel/scheduler.h"
#include "core/hle/kernel/thread.h" #include "core/hle/kernel/thread.h"
#include "core/hle/lock.h"
#include "core/settings.h" #include "core/settings.h"
namespace Core { namespace Core {
...@@ -125,6 +126,8 @@ void Cpu::Reschedule() { ...@@ -125,6 +126,8 @@ void Cpu::Reschedule() {
} }
reschedule_pending = false; reschedule_pending = false;
// Lock the global kernel mutex when we manipulate the HLE state
std::lock_guard<std::recursive_mutex> lock(HLE::g_hle_lock);
scheduler->Reschedule(); scheduler->Reschedule();
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment