summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-13 00:53:54 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:49 +0200
commitdb68fba4a634ab6127ed485f55c41b5e1a05bc10 (patch)
treeaa7ce194061f472e313bd819e0d6402eb1cf1f58 /src
parentGeneral: Fix microprofile on dynarmic/svc, fix wait tree showing which threads were running. (diff)
downloadyuzu-db68fba4a634ab6127ed485f55c41b5e1a05bc10.tar
yuzu-db68fba4a634ab6127ed485f55c41b5e1a05bc10.tar.gz
yuzu-db68fba4a634ab6127ed485f55c41b5e1a05bc10.tar.bz2
yuzu-db68fba4a634ab6127ed485f55c41b5e1a05bc10.tar.lz
yuzu-db68fba4a634ab6127ed485f55c41b5e1a05bc10.tar.xz
yuzu-db68fba4a634ab6127ed485f55c41b5e1a05bc10.tar.zst
yuzu-db68fba4a634ab6127ed485f55c41b5e1a05bc10.zip
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/kernel/scheduler.cpp15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/core/hle/kernel/scheduler.cpp b/src/core/hle/kernel/scheduler.cpp
index 2ad380b17..8d56b49ce 100644
--- a/src/core/hle/kernel/scheduler.cpp
+++ b/src/core/hle/kernel/scheduler.cpp
@@ -144,6 +144,11 @@ u32 GlobalScheduler::SelectThreads() {
bool GlobalScheduler::YieldThread(Thread* yielding_thread) {
ASSERT(is_locked);
// Note: caller should use critical section, etc.
+ if (!yielding_thread->IsRunnable()) {
+ // Normally this case shouldn't happen except for SetThreadActivity.
+ is_reselection_pending.store(true, std::memory_order_release);
+ return false;
+ }
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());
const u32 priority = yielding_thread->GetPriority();
@@ -161,6 +166,11 @@ bool GlobalScheduler::YieldThreadAndBalanceLoad(Thread* yielding_thread) {
ASSERT(is_locked);
// Note: caller should check if !thread.IsSchedulerOperationRedundant and use critical section,
// etc.
+ if (!yielding_thread->IsRunnable()) {
+ // Normally this case shouldn't happen except for SetThreadActivity.
+ is_reselection_pending.store(true, std::memory_order_release);
+ return false;
+ }
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());
const u32 priority = yielding_thread->GetPriority();
@@ -212,6 +222,11 @@ bool GlobalScheduler::YieldThreadAndWaitForLoadBalancing(Thread* yielding_thread
ASSERT(is_locked);
// Note: caller should check if !thread.IsSchedulerOperationRedundant and use critical section,
// etc.
+ if (!yielding_thread->IsRunnable()) {
+ // Normally this case shouldn't happen except for SetThreadActivity.
+ is_reselection_pending.store(true, std::memory_order_release);
+ return false;
+ }
Thread* winner = nullptr;
const u32 core_id = static_cast<u32>(yielding_thread->GetProcessorID());