diff options
Diffstat (limited to 'src/core/hle/kernel/scheduler.cpp')
| -rw-r--r-- | src/core/hle/kernel/scheduler.cpp | 10 |
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 | |||
| 238 | return AskForReselectionOrMarkRedundant(yielding_thread, winner); | 238 | return AskForReselectionOrMarkRedundant(yielding_thread, winner); |
| 239 | } | 239 | } |
| 240 | 240 | ||
| 241 | void GlobalScheduler::PreemptThreads() { | ||
| 242 | for (std::size_t core_id = 0; core_id < NUM_CPU_CORES; core_id++) { | ||
| 243 | const u64 priority = preemption_priorities[core_id]; | ||
| 244 | if (scheduled_queue[core_id].size(priority) > 1) { | ||
| 245 | scheduled_queue[core_id].yield(priority); | ||
| 246 | reselection_pending.store(true, std::memory_order_release); | ||
| 247 | } | ||
| 248 | } | ||
| 249 | } | ||
| 250 | |||
| 241 | void GlobalScheduler::Schedule(u32 priority, u32 core, Thread* thread) { | 251 | void GlobalScheduler::Schedule(u32 priority, u32 core, Thread* thread) { |
| 242 | ASSERT_MSG(thread->GetProcessorID() == core, "Thread must be assigned to this core."); | 252 | ASSERT_MSG(thread->GetProcessorID() == core, "Thread must be assigned to this core."); |
| 243 | scheduled_queue[core].add(thread, priority); | 253 | scheduled_queue[core].add(thread, priority); |