summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_thread.h
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-08-07 08:04:32 +0200
committerbunnei <bunneidev@gmail.com>2021-08-07 21:18:47 +0200
commit01af2f4162308029e53143f0caa953bc4c59de92 (patch)
tree44915af7833f785238411725bbc3947b31200ab8 /src/core/hle/kernel/k_thread.h
parentcore: hle: kernel: Ensure idle threads are closed before destroying scheduler. (diff)
downloadyuzu-01af2f4162308029e53143f0caa953bc4c59de92.tar
yuzu-01af2f4162308029e53143f0caa953bc4c59de92.tar.gz
yuzu-01af2f4162308029e53143f0caa953bc4c59de92.tar.bz2
yuzu-01af2f4162308029e53143f0caa953bc4c59de92.tar.lz
yuzu-01af2f4162308029e53143f0caa953bc4c59de92.tar.xz
yuzu-01af2f4162308029e53143f0caa953bc4c59de92.tar.zst
yuzu-01af2f4162308029e53143f0caa953bc4c59de92.zip
Diffstat (limited to 'src/core/hle/kernel/k_thread.h')
-rw-r--r--src/core/hle/kernel/k_thread.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_thread.h b/src/core/hle/kernel/k_thread.h
index c77f44ad4..a149744c8 100644
--- a/src/core/hle/kernel/k_thread.h
+++ b/src/core/hle/kernel/k_thread.h
@@ -450,16 +450,35 @@ public:
sleeping_queue = q;
}
+ [[nodiscard]] bool IsKernelThread() const {
+ return GetActiveCore() == 3;
+ }
+
[[nodiscard]] s32 GetDisableDispatchCount() const {
+ if (IsKernelThread()) {
+ // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
+ return 1;
+ }
+
return this->GetStackParameters().disable_count;
}
void DisableDispatch() {
+ if (IsKernelThread()) {
+ // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
+ return;
+ }
+
ASSERT(GetCurrentThread(kernel).GetDisableDispatchCount() >= 0);
this->GetStackParameters().disable_count++;
}
void EnableDispatch() {
+ if (IsKernelThread()) {
+ // TODO(bunnei): Until kernel threads are emulated, we cannot enable/disable dispatch.
+ return;
+ }
+
ASSERT(GetCurrentThread(kernel).GetDisableDispatchCount() > 0);
this->GetStackParameters().disable_count--;
}
@@ -752,4 +771,16 @@ public:
}
};
+class KScopedDisableDispatch {
+public:
+ explicit KScopedDisableDispatch(KernelCore& kernel_) : kernel{kernel_} {
+ GetCurrentThread(kernel).DisableDispatch();
+ }
+
+ ~KScopedDisableDispatch();
+
+private:
+ KernelCore& kernel;
+};
+
} // namespace Kernel