summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/k_thread_queue.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2021-11-10 04:02:11 +0100
committerbunnei <bunneidev@gmail.com>2021-12-07 01:39:17 +0100
commitbc1399204b914608715306a8a8dbe2f201dd4365 (patch)
tree7799195284bb20b15cd6be6addea57f45364136f /src/core/hle/kernel/k_thread_queue.cpp
parentcore: hle: kernel: Disable dispatch count tracking on single core. (diff)
downloadyuzu-bc1399204b914608715306a8a8dbe2f201dd4365.tar
yuzu-bc1399204b914608715306a8a8dbe2f201dd4365.tar.gz
yuzu-bc1399204b914608715306a8a8dbe2f201dd4365.tar.bz2
yuzu-bc1399204b914608715306a8a8dbe2f201dd4365.tar.lz
yuzu-bc1399204b914608715306a8a8dbe2f201dd4365.tar.xz
yuzu-bc1399204b914608715306a8a8dbe2f201dd4365.tar.zst
yuzu-bc1399204b914608715306a8a8dbe2f201dd4365.zip
Diffstat (limited to 'src/core/hle/kernel/k_thread_queue.cpp')
-rw-r--r--src/core/hle/kernel/k_thread_queue.cpp51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/core/hle/kernel/k_thread_queue.cpp b/src/core/hle/kernel/k_thread_queue.cpp
new file mode 100644
index 000000000..46f27172b
--- /dev/null
+++ b/src/core/hle/kernel/k_thread_queue.cpp
@@ -0,0 +1,51 @@
+// Copyright 2021 yuzu Emulator Project
+// Licensed under GPLv2 or any later version
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include "core/hle/kernel/k_thread_queue.h"
+#include "core/hle/kernel/kernel.h"
+#include "core/hle/kernel/time_manager.h"
+
+namespace Kernel {
+
+void KThreadQueue::NotifyAvailable([[maybe_unused]] KThread* waiting_thread,
+ [[maybe_unused]] KSynchronizationObject* signaled_object,
+ [[maybe_unused]] ResultCode wait_result) {}
+
+void KThreadQueue::EndWait(KThread* waiting_thread, ResultCode wait_result) {
+ // Set the thread's wait result.
+ waiting_thread->SetWaitResult(wait_result);
+
+ // Set the thread as runnable.
+ waiting_thread->SetState(ThreadState::Runnable);
+
+ // Clear the thread's wait queue.
+ waiting_thread->ClearWaitQueue();
+
+ // Cancel the thread task.
+ kernel.TimeManager().UnscheduleTimeEvent(waiting_thread);
+}
+
+void KThreadQueue::CancelWait(KThread* waiting_thread, ResultCode wait_result,
+ bool cancel_timer_task) {
+ // Set the thread's wait result.
+ waiting_thread->SetWaitResult(wait_result);
+
+ // Set the thread as runnable.
+ waiting_thread->SetState(ThreadState::Runnable);
+
+ // Clear the thread's wait queue.
+ waiting_thread->ClearWaitQueue();
+
+ // Cancel the thread task.
+ if (cancel_timer_task) {
+ kernel.TimeManager().UnscheduleTimeEvent(waiting_thread);
+ }
+}
+
+void KThreadQueueWithoutEndWait::EndWait([[maybe_unused]] KThread* waiting_thread,
+ [[maybe_unused]] ResultCode wait_result) {}
+
+} // namespace Kernel