mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
Merge pull request #1762 from bunnei/global
hle: Get rid of direct global access to g_reschedule
This commit is contained in:
commit
75cbfeee58
|
@ -51,7 +51,7 @@ void RunLoop(int tight_loop) {
|
||||||
}
|
}
|
||||||
|
|
||||||
HW::Update();
|
HW::Update();
|
||||||
if (HLE::g_reschedule) {
|
if (HLE::IsReschedulePending()) {
|
||||||
Kernel::Reschedule();
|
Kernel::Reschedule();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,9 +12,13 @@
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
namespace HLE {
|
namespace {
|
||||||
|
|
||||||
bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread
|
bool reschedule; ///< If true, immediately reschedules the CPU to a new thread
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
namespace HLE {
|
||||||
|
|
||||||
void Reschedule(const char *reason) {
|
void Reschedule(const char *reason) {
|
||||||
DEBUG_ASSERT_MSG(reason != nullptr && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
|
DEBUG_ASSERT_MSG(reason != nullptr && strlen(reason) < 256, "Reschedule: Invalid or too long reason.");
|
||||||
|
@ -27,13 +31,21 @@ void Reschedule(const char *reason) {
|
||||||
|
|
||||||
Core::g_app_core->PrepareReschedule();
|
Core::g_app_core->PrepareReschedule();
|
||||||
|
|
||||||
g_reschedule = true;
|
reschedule = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool IsReschedulePending() {
|
||||||
|
return reschedule;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DoneRescheduling() {
|
||||||
|
reschedule = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Init() {
|
void Init() {
|
||||||
Service::Init();
|
Service::Init();
|
||||||
|
|
||||||
g_reschedule = false;
|
reschedule = false;
|
||||||
|
|
||||||
LOG_DEBUG(Kernel, "initialized OK");
|
LOG_DEBUG(Kernel, "initialized OK");
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,9 @@ const Handle INVALID_HANDLE = 0;
|
||||||
|
|
||||||
namespace HLE {
|
namespace HLE {
|
||||||
|
|
||||||
extern bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread
|
|
||||||
|
|
||||||
void Reschedule(const char *reason);
|
void Reschedule(const char *reason);
|
||||||
|
bool IsReschedulePending();
|
||||||
|
void DoneRescheduling();
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
|
@ -483,7 +483,8 @@ void Reschedule() {
|
||||||
|
|
||||||
Thread* cur = GetCurrentThread();
|
Thread* cur = GetCurrentThread();
|
||||||
Thread* next = PopNextReadyThread();
|
Thread* next = PopNextReadyThread();
|
||||||
HLE::g_reschedule = false;
|
|
||||||
|
HLE::DoneRescheduling();
|
||||||
|
|
||||||
// Don't bother switching to the same thread
|
// Don't bother switching to the same thread
|
||||||
if (next == cur)
|
if (next == cur)
|
||||||
|
|
Loading…
Reference in a new issue