diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2019-09-10 17:04:40 +0200 |
---|---|---|
committer | FernandoS27 <fsahmkow27@gmail.com> | 2019-10-15 17:55:14 +0200 |
commit | b49c0dab8772afb06358e5d19af092226b3a59bb (patch) | |
tree | 00e1cad505f915f5d7d286c5627b8e13f5eb78ff /src/core/hle/kernel/scheduler.cpp | |
parent | Scheduler: Add protections for Yield bombing (diff) | |
download | yuzu-b49c0dab8772afb06358e5d19af092226b3a59bb.tar yuzu-b49c0dab8772afb06358e5d19af092226b3a59bb.tar.gz yuzu-b49c0dab8772afb06358e5d19af092226b3a59bb.tar.bz2 yuzu-b49c0dab8772afb06358e5d19af092226b3a59bb.tar.lz yuzu-b49c0dab8772afb06358e5d19af092226b3a59bb.tar.xz yuzu-b49c0dab8772afb06358e5d19af092226b3a59bb.tar.zst yuzu-b49c0dab8772afb06358e5d19af092226b3a59bb.zip |
Diffstat (limited to '')
-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 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); |