2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Merge pull request #8523 from liamwhite/sc-oopsie

cpu_manager: properly check idle on return from preemption
This commit is contained in:
Fernando S 2022-07-01 22:40:02 +02:00 committed by GitHub
commit 3f3c2dc20f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View file

@ -194,7 +194,9 @@ void CpuManager::PreemptSingleCore(bool from_running_enviroment) {
{ {
auto& scheduler = system.Kernel().Scheduler(current_core); auto& scheduler = system.Kernel().Scheduler(current_core);
scheduler.Reload(scheduler.GetSchedulerCurrentThread()); scheduler.Reload(scheduler.GetSchedulerCurrentThread());
idle_count = 0; if (!scheduler.IsIdle()) {
idle_count = 0;
}
} }
} }

View file

@ -55,6 +55,11 @@ public:
return idle_thread; return idle_thread;
} }
/// Returns true if the scheduler is idle
[[nodiscard]] bool IsIdle() const {
return GetSchedulerCurrentThread() == idle_thread;
}
/// Gets the timestamp for the last context switch in ticks. /// Gets the timestamp for the last context switch in ticks.
[[nodiscard]] u64 GetLastContextSwitchTicks() const; [[nodiscard]] u64 GetLastContextSwitchTicks() const;