diff options
| author | Lioncash <mathew1800@gmail.com> | 2019-03-15 23:28:29 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2019-03-15 23:58:31 -0400 |
| commit | c892cf01fad0c1fdeb6fc4644000c026176fe05a (patch) | |
| tree | 4a4b6aac7d872c204fb4b9d4279f041d04939d15 /src/core/hle/kernel/thread.cpp | |
| parent | 3bfd199497bd016e79ba27f338c0dd77923080d1 (diff) | |
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.cpp | 13 |
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() { owner_process->FreeTLSSlot(tls_address); } -void WaitCurrentThread_Sleep() { - Thread* thread = GetCurrentThread(); - thread->SetStatus(ThreadStatus::WaitSleep); -} - void ExitCurrentThread() { Thread* thread = GetCurrentThread(); thread->Stop(); @@ -391,6 +386,14 @@ void Thread::SetActivity(ThreadActivity value) { } } +void Thread::Sleep(s64 nanoseconds) { + // Sleep current thread and check for next thread to schedule + SetStatus(ThreadStatus::WaitSleep); + + // Create an event to wake the thread up after the specified nanosecond delay has passed + WakeAfterDelay(nanoseconds); +} + //////////////////////////////////////////////////////////////////////////////////////////////////// /** |
