diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/core.cpp | 2 | ||||
| -rw-r--r-- | src/core/hle/hle.cpp | 20 | ||||
| -rw-r--r-- | src/core/hle/hle.h | 4 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 3 |
4 files changed, 21 insertions, 8 deletions
diff --git a/src/core/core.cpp b/src/core/core.cpp index 84d6c392e..609ca860d 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp | |||
| @@ -52,7 +52,7 @@ void RunLoop(int tight_loop) { | |||
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | HW::Update(); | 54 | HW::Update(); |
| 55 | if (HLE::g_reschedule) { | 55 | if (HLE::RescheduleIsPending()) { |
| 56 | Kernel::Reschedule(); | 56 | Kernel::Reschedule(); |
| 57 | } | 57 | } |
| 58 | } | 58 | } |
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp index 331b1b22a..3b1369800 100644 --- a/src/core/hle/hle.cpp +++ b/src/core/hle/hle.cpp | |||
| @@ -14,9 +14,13 @@ | |||
| 14 | 14 | ||
| 15 | //////////////////////////////////////////////////////////////////////////////////////////////////// | 15 | //////////////////////////////////////////////////////////////////////////////////////////////////// |
| 16 | 16 | ||
| 17 | namespace HLE { | 17 | namespace { |
| 18 | |||
| 19 | bool reschedule; ///< If true, immediately reschedules the CPU to a new thread | ||
| 18 | 20 | ||
| 19 | bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread | 21 | } |
| 22 | |||
| 23 | namespace HLE { | ||
| 20 | 24 | ||
| 21 | void Reschedule(const char *reason) { | 25 | void Reschedule(const char *reason) { |
| 22 | DEBUG_ASSERT_MSG(reason != nullptr && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); | 26 | DEBUG_ASSERT_MSG(reason != nullptr && strlen(reason) < 256, "Reschedule: Invalid or too long reason."); |
| @@ -29,13 +33,21 @@ void Reschedule(const char *reason) { | |||
| 29 | 33 | ||
| 30 | Core::g_app_core->PrepareReschedule(); | 34 | Core::g_app_core->PrepareReschedule(); |
| 31 | 35 | ||
| 32 | g_reschedule = true; | 36 | reschedule = true; |
| 37 | } | ||
| 38 | |||
| 39 | bool RescheduleIsPending() { | ||
| 40 | return reschedule; | ||
| 41 | } | ||
| 42 | |||
| 43 | void DoneRescheduling() { | ||
| 44 | reschedule = false; | ||
| 33 | } | 45 | } |
| 34 | 46 | ||
| 35 | void Init() { | 47 | void Init() { |
| 36 | Service::Init(); | 48 | Service::Init(); |
| 37 | 49 | ||
| 38 | g_reschedule = false; | 50 | reschedule = false; |
| 39 | 51 | ||
| 40 | LOG_DEBUG(Kernel, "initialized OK"); | 52 | LOG_DEBUG(Kernel, "initialized OK"); |
| 41 | } | 53 | } |
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h index e0b97797c..58dffe587 100644 --- a/src/core/hle/hle.h +++ b/src/core/hle/hle.h | |||
| @@ -13,9 +13,9 @@ const Handle INVALID_HANDLE = 0; | |||
| 13 | 13 | ||
| 14 | namespace HLE { | 14 | namespace HLE { |
| 15 | 15 | ||
| 16 | extern bool g_reschedule; ///< If true, immediately reschedules the CPU to a new thread | ||
| 17 | |||
| 18 | void Reschedule(const char *reason); | 16 | void Reschedule(const char *reason); |
| 17 | bool RescheduleIsPending(); | ||
| 18 | void DoneRescheduling(); | ||
| 19 | 19 | ||
| 20 | void Init(); | 20 | void Init(); |
| 21 | void Shutdown(); | 21 | 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() { | |||
| 483 | 483 | ||
| 484 | Thread* cur = GetCurrentThread(); | 484 | Thread* cur = GetCurrentThread(); |
| 485 | Thread* next = PopNextReadyThread(); | 485 | Thread* next = PopNextReadyThread(); |
| 486 | HLE::g_reschedule = false; | 486 | |
| 487 | HLE::DoneRescheduling(); | ||
| 487 | 488 | ||
| 488 | // Don't bother switching to the same thread | 489 | // Don't bother switching to the same thread |
| 489 | if (next == cur) | 490 | if (next == cur) |