mirror of
https://gitlab.com/suyu-emu/suyu.git
synced 2024-03-15 23:15:44 +00:00
cpu_manager: properly check idle on return from preemption
This commit is contained in:
parent
603952bc27
commit
2c1e2c63c3
|
@ -194,9 +194,11 @@ 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());
|
||||||
|
if (!scheduler.IsIdle()) {
|
||||||
idle_count = 0;
|
idle_count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CpuManager::ShutdownThread() {
|
void CpuManager::ShutdownThread() {
|
||||||
auto& kernel = system.Kernel();
|
auto& kernel = system.Kernel();
|
||||||
|
|
|
@ -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;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue