diff options
author | Zach Hilman <zachhilman@gmail.com> | 2018-12-02 06:44:40 +0100 |
---|---|---|
committer | Zach Hilman <zachhilman@gmail.com> | 2018-12-02 06:44:40 +0100 |
commit | 3476830b26b61410b633c827e985bffa1dc52528 (patch) | |
tree | cedba8440c12c3d8edeb78f33de5c56f2488b60f /src/core | |
parent | scheduler: Add explanations for YieldWith and WithoutLoadBalancing (diff) | |
download | yuzu-3476830b26b61410b633c827e985bffa1dc52528.tar yuzu-3476830b26b61410b633c827e985bffa1dc52528.tar.gz yuzu-3476830b26b61410b633c827e985bffa1dc52528.tar.bz2 yuzu-3476830b26b61410b633c827e985bffa1dc52528.tar.lz yuzu-3476830b26b61410b633c827e985bffa1dc52528.tar.xz yuzu-3476830b26b61410b633c827e985bffa1dc52528.tar.zst yuzu-3476830b26b61410b633c827e985bffa1dc52528.zip |
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 3 | ||||
-rw-r--r-- | src/core/hle/kernel/svc.cpp | 11 |
2 files changed, 6 insertions, 8 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp index 624c841ad..efe3551e2 100644 --- a/src/core/hle/kernel/scheduler.cpp +++ b/src/core/hle/kernel/scheduler.cpp @@ -207,8 +207,8 @@ void Scheduler::YieldWithoutLoadBalancing(Thread* thread) { ASSERT(thread->GetPriority() < THREADPRIO_COUNT); // Yield this thread - MoveThreadToBackOfPriorityQueue(thread, thread->GetPriority()); Reschedule(); + MoveThreadToBackOfPriorityQueue(thread, thread->GetPriority()); } void Scheduler::YieldWithLoadBalancing(Thread* thread) { @@ -223,6 +223,7 @@ void Scheduler::YieldWithLoadBalancing(Thread* thread) { ASSERT(priority < THREADPRIO_COUNT); // Reschedule thread to end of queue. + Reschedule(); MoveThreadToBackOfPriorityQueue(thread, priority); Thread* suggested_thread = nullptr; diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 205706033..c119f7be1 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -962,13 +962,13 @@ static void SleepThread(s64 nanoseconds) { // Don't attempt to yield execution if there are no available threads to run, // this way we avoid a useless reschedule to the idle thread. - if (!Core::System::GetInstance().CurrentScheduler().HaveReadyThreads()) + if (nanoseconds <= 0 && !Core::System::GetInstance().CurrentScheduler().HaveReadyThreads()) return; enum class SleepType : s64 { YieldWithoutLoadBalancing = 0, - YieldWithLoadBalancing = 1, - YieldAndWaitForLoadBalancing = 2, + YieldWithLoadBalancing = -1, + YieldAndWaitForLoadBalancing = -2, }; if (nanoseconds <= 0) { @@ -998,10 +998,7 @@ static void SleepThread(s64 nanoseconds) { // Create an event to wake the thread up after the specified nanosecond delay has passed GetCurrentThread()->WakeAfterDelay(nanoseconds); - Core::System::GetInstance().CpuCore(0).PrepareReschedule(); - Core::System::GetInstance().CpuCore(1).PrepareReschedule(); - Core::System::GetInstance().CpuCore(2).PrepareReschedule(); - Core::System::GetInstance().CpuCore(3).PrepareReschedule(); + Core::System::GetInstance().PrepareReschedule(); } /// Wait process wide key atomic |