From 2c1e2c63c302dc4a2f0ad3452263d715d77aba8c Mon Sep 17 00:00:00 2001
From: Liam <byteslice@airmail.cc>
Date: Thu, 30 Jun 2022 16:54:05 -0400
Subject: cpu_manager: properly check idle on return from preemption

---
 src/core/cpu_manager.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

(limited to 'src/core/cpu_manager.cpp')

diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index fd6928105a..9fc78f033c 100644
--- a/src/core/cpu_manager.cpp
+++ b/src/core/cpu_manager.cpp
@@ -194,7 +194,9 @@ void CpuManager::PreemptSingleCore(bool from_running_enviroment) {
     {
         auto& scheduler = system.Kernel().Scheduler(current_core);
         scheduler.Reload(scheduler.GetSchedulerCurrentThread());
-        idle_count = 0;
+        if (!scheduler.IsIdle()) {
+            idle_count = 0;
+        }
     }
 }
 
-- 
cgit v1.2.3-70-g09d2