summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2016-05-06 03:45:57 +0200
committerbunnei <bunneidev@gmail.com>2016-05-06 03:45:57 +0200
commit75cbfeee58cd3062cd097dbd355cbd51b840f326 (patch)
treef23ca2b0fc619b2648e3f298a18bfb15f3a8067a
parentMerge pull request #1700 from wwylele/gamelist-icon (diff)
parentHLE: Rename RescheduleIsPending to IsReschedulePending. (diff)
downloadyuzu-75cbfeee58cd3062cd097dbd355cbd51b840f326.tar
yuzu-75cbfeee58cd3062cd097dbd355cbd51b840f326.tar.gz
yuzu-75cbfeee58cd3062cd097dbd355cbd51b840f326.tar.bz2
yuzu-75cbfeee58cd3062cd097dbd355cbd51b840f326.tar.lz
yuzu-75cbfeee58cd3062cd097dbd355cbd51b840f326.tar.xz
yuzu-75cbfeee58cd3062cd097dbd355cbd51b840f326.tar.zst
yuzu-75cbfeee58cd3062cd097dbd355cbd51b840f326.zip
-rw-r--r--src/core/core.cpp2
-rw-r--r--src/core/hle/hle.cpp20
-rw-r--r--src/core/hle/hle.h4
-rw-r--r--src/core/hle/kernel/thread.cpp3
4 files changed, 21 insertions, 8 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp
index 3bb843aab..cabab744a 100644
--- a/src/core/core.cpp
+++ b/src/core/core.cpp
@@ -51,7 +51,7 @@ void RunLoop(int tight_loop) {
}
HW::Update();
- if (HLE::g_reschedule) {
+ if (HLE::IsReschedulePending()) {
Kernel::Reschedule();
}
}
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index e545de3b5..5c5373517 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -12,9 +12,13 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
-namespace HLE {
+namespace {
+
+bool reschedule; ///< If true, immediately reschedules the CPU to a new thread
-bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread
+}
+
+namespace HLE {
void Reschedule(const char *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();
- g_reschedule = true;
+ reschedule = true;
+}
+
+bool IsReschedulePending() {
+ return reschedule;
+}
+
+void DoneRescheduling() {
+ reschedule = false;
}
void Init() {
Service::Init();
- g_reschedule = false;
+ reschedule = false;
LOG_DEBUG(Kernel, "initialized OK");
}
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index e0b97797c..69ac0ade6 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -13,9 +13,9 @@ const Handle INVALID_HANDLE = 0;
namespace HLE {
-extern bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread
-
void Reschedule(const char *reason);
+bool IsReschedulePending();
+void DoneRescheduling();
void Init();
void Shutdown();
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index bf32f653d..6dc95d0f1 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -483,7 +483,8 @@ void Reschedule() {
Thread* cur = GetCurrentThread();
Thread* next = PopNextReadyThread();
- HLE::g_reschedule = false;
+
+ HLE::DoneRescheduling();
// Don't bother switching to the same thread
if (next == cur)