From 60a373a7862a85b8b030ea1b18d01d364ddf8a8b Mon Sep 17 00:00:00 2001 From: Subv Date: Wed, 7 Jan 2015 10:10:58 -0500 Subject: Threads: Use a dummy idle thread when no other are ready. This thread will not actually execute instructions, it will only advance the timing/events and try to yield immediately to the next ready thread, if there aren't any ready threads then it will be rescheduled and start its job again. --- src/core/hle/kernel/thread.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/core/hle/kernel/thread.h') diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index 0e1397cd9..dfe92d162 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -104,6 +104,17 @@ ResultVal GetThreadPriority(const Handle handle); /// Set the priority of the thread specified by handle ResultCode SetThreadPriority(Handle handle, s32 priority); +/** + * Sets up the idle thread, this is a thread that is intended to never execute instructions, + * only to advance the timing. It is scheduled when there are no other ready threads in the thread queue + * and will try to yield on every call. + * @returns The handle of the idle thread + */ +Handle SetupIdleThread(); + +/// Whether the current thread is an idle thread +bool IsIdleThread(Handle thread); + /// Initialize threading void ThreadingInit(); -- cgit v1.2.3