diff options
author | Lioncash <mathew1800@gmail.com> | 2019-03-16 04:28:29 +0100 |
---|---|---|
committer | Lioncash <mathew1800@gmail.com> | 2019-03-16 04:58:31 +0100 |
commit | c892cf01fad0c1fdeb6fc4644000c026176fe05a (patch) | |
tree | 4a4b6aac7d872c204fb4b9d4279f041d04939d15 /src/core/hle/kernel/svc.cpp | |
parent | Merge pull request #2211 from lioncash/arbiter (diff) | |
download | yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.tar yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.tar.gz yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.tar.bz2 yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.tar.lz yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.tar.xz yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.tar.zst yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.zip |
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 77d0e3d96..bf77ce137 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1300,32 +1300,32 @@ static void SleepThread(s64 nanoseconds) { YieldAndWaitForLoadBalancing = -2, }; + auto& system = Core::System::GetInstance(); + auto& scheduler = system.CurrentScheduler(); + auto* const current_thread = scheduler.GetCurrentThread(); + if (nanoseconds <= 0) { - auto& scheduler{Core::System::GetInstance().CurrentScheduler()}; switch (static_cast<SleepType>(nanoseconds)) { case SleepType::YieldWithoutLoadBalancing: - scheduler.YieldWithoutLoadBalancing(GetCurrentThread()); + scheduler.YieldWithoutLoadBalancing(current_thread); break; case SleepType::YieldWithLoadBalancing: - scheduler.YieldWithLoadBalancing(GetCurrentThread()); + scheduler.YieldWithLoadBalancing(current_thread); break; case SleepType::YieldAndWaitForLoadBalancing: - scheduler.YieldAndWaitForLoadBalancing(GetCurrentThread()); + scheduler.YieldAndWaitForLoadBalancing(current_thread); break; default: UNREACHABLE_MSG("Unimplemented sleep yield type '{:016X}'!", nanoseconds); } } else { - // Sleep current thread and check for next thread to schedule - WaitCurrentThread_Sleep(); - - // Create an event to wake the thread up after the specified nanosecond delay has passed - GetCurrentThread()->WakeAfterDelay(nanoseconds); + current_thread->Sleep(nanoseconds); } // Reschedule all CPU cores - for (std::size_t i = 0; i < Core::NUM_CPU_CORES; ++i) - Core::System::GetInstance().CpuCore(i).PrepareReschedule(); + for (std::size_t i = 0; i < Core::NUM_CPU_CORES; ++i) { + system.CpuCore(i).PrepareReschedule(); + } } /// Wait process wide key atomic |