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.
This commit is contained in:
parent
b659cac2dc
commit
60a373a786
4 changed files with 47 additions and 2 deletions
|
@ -104,6 +104,17 @@ ResultVal<u32> 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();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue