From 8b973a3de32c0fcad508bbda768c295baef3fc31 Mon Sep 17 00:00:00 2001 From: PixelyIon Date: Wed, 30 Nov 2022 02:52:52 +0530 Subject: [PATCH] Always set `forceYield` for running threads in `PauseThread` `forceYield` was incorrectly not set when pausing running threads if the thread already had `pendingYield` set. This could lead to cases where `Rotate` would later throw an exception due to it being unset. --- app/src/main/cpp/skyline/kernel/scheduler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/cpp/skyline/kernel/scheduler.cpp b/app/src/main/cpp/skyline/kernel/scheduler.cpp index 2ae135bb..ccabc25a 100644 --- a/app/src/main/cpp/skyline/kernel/scheduler.cpp +++ b/app/src/main/cpp/skyline/kernel/scheduler.cpp @@ -379,10 +379,12 @@ namespace skyline::kernel { if (it == core->queue.begin() && it != core->queue.end()) (*it)->scheduleCondition.notify_one(); - if (it == core->queue.begin() && !thread->pendingYield) { + if (it == core->queue.begin()) { // We need to send a yield signal to the thread if it's currently running - thread->SendSignal(YieldSignal); - thread->pendingYield = true; + if (!thread->pendingYield) { + thread->SendSignal(YieldSignal); + thread->pendingYield = true; + } thread->forceYield = true; } } else {