summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFernando S <fsahmkow27@gmail.com>2022-07-01 22:40:02 +0200
committerGitHub <noreply@github.com>2022-07-01 22:40:02 +0200
commit3f3c2dc20fec7c922c4f9ef5774f198fbb6aee31 (patch)
tree2e66dc86f9ee31763bbed780e7df2970900fa4df /src
parentMerge pull request #8490 from liamwhite/read-code-stop (diff)
parentcpu_manager: properly check idle on return from preemption (diff)
downloadyuzu-3f3c2dc20fec7c922c4f9ef5774f198fbb6aee31.tar
yuzu-3f3c2dc20fec7c922c4f9ef5774f198fbb6aee31.tar.gz
yuzu-3f3c2dc20fec7c922c4f9ef5774f198fbb6aee31.tar.bz2
yuzu-3f3c2dc20fec7c922c4f9ef5774f198fbb6aee31.tar.lz
yuzu-3f3c2dc20fec7c922c4f9ef5774f198fbb6aee31.tar.xz
yuzu-3f3c2dc20fec7c922c4f9ef5774f198fbb6aee31.tar.zst
yuzu-3f3c2dc20fec7c922c4f9ef5774f198fbb6aee31.zip
Diffstat (limited to '')
-rw-r--r--src/core/cpu_manager.cpp4
-rw-r--r--src/core/hle/kernel/k_scheduler.h5
2 files changed, 8 insertions, 1 deletions
diff --git a/src/core/cpu_manager.cpp b/src/core/cpu_manager.cpp
index fd6928105..9fc78f033 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;
+ }
}
}
diff --git a/src/core/hle/kernel/k_scheduler.h b/src/core/hle/kernel/k_scheduler.h
index 3f90656ee..cc3da33f5 100644
--- a/src/core/hle/kernel/k_scheduler.h
+++ b/src/core/hle/kernel/k_scheduler.h
@@ -55,6 +55,11 @@ public:
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.
[[nodiscard]] u64 GetLastContextSwitchTicks() const;