summaryrefslogtreecommitdiff
path: root/src/core/hle/kernel/thread.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-03-15 23:28:29 -0400
committerGravatar Lioncash2019-03-15 23:58:31 -0400
commitc892cf01fad0c1fdeb6fc4644000c026176fe05a (patch)
tree4a4b6aac7d872c204fb4b9d4279f041d04939d15 /src/core/hle/kernel/thread.cpp
parentMerge pull request #2211 from lioncash/arbiter (diff)
downloadyuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.tar.gz
yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.tar.xz
yuzu-c892cf01fad0c1fdeb6fc4644000c026176fe05a.zip
kernel/thread: Migrate WaitCurrentThread_Sleep into the Thread interface
Rather than make a global accessor for this sort of thing. We can make it a part of the thread interface itself. This allows getting rid of a hidden global accessor in the kernel code.
Diffstat (limited to 'src/core/hle/kernel/thread.cpp')
-rw-r--r--src/core/hle/kernel/thread.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp
index eb54d6651..2e712c9cb 100644
--- a/src/core/hle/kernel/thread.cpp
+++ b/src/core/hle/kernel/thread.cpp
@@ -68,11 +68,6 @@ void Thread::Stop() {
68 owner_process->FreeTLSSlot(tls_address); 68 owner_process->FreeTLSSlot(tls_address);
69} 69}
70 70
71void WaitCurrentThread_Sleep() {
72 Thread* thread = GetCurrentThread();
73 thread->SetStatus(ThreadStatus::WaitSleep);
74}
75
76void ExitCurrentThread() { 71void ExitCurrentThread() {
77 Thread* thread = GetCurrentThread(); 72 Thread* thread = GetCurrentThread();
78 thread->Stop(); 73 thread->Stop();
@@ -391,6 +386,14 @@ void Thread::SetActivity(ThreadActivity value) {
391 } 386 }
392} 387}
393 388
389void Thread::Sleep(s64 nanoseconds) {
390 // Sleep current thread and check for next thread to schedule
391 SetStatus(ThreadStatus::WaitSleep);
392
393 // Create an event to wake the thread up after the specified nanosecond delay has passed
394 WakeAfterDelay(nanoseconds);
395}
396
394//////////////////////////////////////////////////////////////////////////////////////////////////// 397////////////////////////////////////////////////////////////////////////////////////////////////////
395 398
396/** 399/**