summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/scheduler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
-rw-r--r--src/core/hle/kernel/scheduler.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 451fd8077..0d45307cd 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -238,6 +238,16 @@ bool GlobalScheduler::YieldThreadAndWaitForLoadBalancing(Thread* yielding_thread
return AskForReselectionOrMarkRedundant(yielding_thread, winner);
}
+void GlobalScheduler::PreemptThreads() {
+ for (std::size_t core_id = 0; core_id < NUM_CPU_CORES; core_id++) {
+ const u64 priority = preemption_priorities[core_id];
+ if (scheduled_queue[core_id].size(priority) > 1) {
+ scheduled_queue[core_id].yield(priority);
+ reselection_pending.store(true, std::memory_order_release);
+ }
+ }
+}
+
void GlobalScheduler::Schedule(u32 priority, u32 core, Thread* thread) {
ASSERT_MSG(thread->GetProcessorID() == core, "Thread must be assigned to this core.");
scheduled_queue[core].add(thread, priority);