#include <cafe/os.h> BOOL OSSetThreadRunQuantum(OSThread* thread, u32 quantumMicrosec);
|thread||Pointer to the thread structure.|
|quantumMicrosec||Number of microseconds to run thread at the current priority.|
Sets the "run quantum" for the current thread.
OSSetThreadRunQuantum sets the amount of time, in microseconds, that a thread will run before the OS attempts to reschedule. The lower bound for the run quantum is 10
OS_THREAD_QUANTUM_MIN_MICROSECONDS). The maximum bound for the run quantum is
0xFFFFF microseconds (
OS_THREAD_QUANTUM_MAX_MICROSECONDS), or slightly more than 1 second. Upon rescheduling, the full set of threads and priorities is evaluated to determine the next thread to run.
OSSetThreadRunQuantum allows multiple threads that exist at the same priority to be run for a specific amount of time before the next thread on the queue (for that priority) is allowed to run. This allows a simple form of preemptive scheduling that is
under the control of the application.
OSThreads that are using a "run quantum" can yield the remainder of their quantum by calling
OSThreads that are not using a "run quantum" are considered "run-to-completion". "Run-to-completion"
OSThreads at the same priority prevent "run quantum" threads at the same priority from executing.
OSSetThreadRunQuantum can be called on the currently executing thread and is in effect when the function returns.
2013-05-08 Automated cleanup pass.
2012-08-01 Cleanup pass.
2012-04-12 Initial version.