aboutsummaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/k_scheduler.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-01-21 22:34:47 -0800
committerGitHub <noreply@github.com>2022-01-21 22:34:47 -0800
commit7240568f00a4b0326771f8a926bdc6089ad44f9b (patch)
tree4a8965dd8c142333e681564a8da803c2e4a45a56 /src/core/hle/kernel/k_scheduler.cpp
parent606e64337882be4eb96d522aba5e6debef398263 (diff)
parentb3f8d2491db60f67c88c76cd0d6c483aad34c708 (diff)
Merge pull request #7737 from bunnei/fix-dummy-thread-leak
Various fixes to HLE service thread management
Diffstat (limited to 'src/core/hle/kernel/k_scheduler.cpp')
-rw-r--r--src/core/hle/kernel/k_scheduler.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_scheduler.cpp b/src/core/hle/kernel/k_scheduler.cpp
index f900b2e7a0..b32d4f2857 100644
--- a/src/core/hle/kernel/k_scheduler.cpp
+++ b/src/core/hle/kernel/k_scheduler.cpp
@@ -406,6 +406,9 @@ void KScheduler::EnableScheduling(KernelCore& kernel, u64 cores_needing_scheduli
} else {
RescheduleCores(kernel, cores_needing_scheduling);
}
+
+ // Special case to ensure dummy threads that are waiting block.
+ current_thread->IfDummyThreadTryWait();
}
u64 KScheduler::UpdateHighestPriorityThreads(KernelCore& kernel) {
@@ -739,6 +742,12 @@ void KScheduler::ScheduleImpl() {
next_thread = idle_thread;
}
+ // We never want to schedule a dummy thread, as these are only used by host threads for locking.
+ if (next_thread->GetThreadType() == ThreadType::Dummy) {
+ ASSERT_MSG(false, "Dummy threads should never be scheduled!");
+ next_thread = idle_thread;
+ }
+
// If we're not actually switching thread, there's nothing to do.
if (next_thread == current_thread.load()) {
previous_thread->EnableDispatch();