#include <nitro/os.h>
void OS_WakeupThread( OSThreadQueue* queue );
queue | Pointer to the thread queue where the thread to be recovered is registered. |
None.
Recovers all threads in the specified thread queue.
This function recovers all threads from within the thread queue designated with queue that were paused by OS_SleepThread()
. After this the threads are scheduled based on priority. Priority was assigned when the thread was created with OS_CreateThread()
, and if threads have the same priority, their priority order will depend on their status in the internal list. This means that from the user side which thread gets first priority is undefined. The order that threads are registered in the thread queue is not related to the priorities.
The following is an example of using OS_WakeupThread()
.
Example:
#define THREAD1_PRIO 1 #define THREAD2_PRIO 2 #define STACK_SIZE 1024 void proc1( void ); void proc2( void ); OSThread thread1; OSThread thread2; OSThreadQueue queue; u64 stack1[ STACK_SIZE / sizeof(u64) ]; u64 stack2[ STACK_SIZE / sizeof(u64) ]; void nitroMain() { : OS_InitThread(); OS_InitThreadQueue( &queue ); OS_CreateThread( &thread1, proc1, stack1+STACK_SIZE/sizeof(u64), STACK_SIZE, THREAD1_PRIO ); OS_CreateThread( &thread2, proc2, stack2+STACK_SIZE/sizeof(u64), STACK_SIZE, THREAD2_PRIO ); OS_WakeupThreadDirect( &thread1 ); OS_WakeupThreadDirect( &thread2 ); : while(1) { : OS_WakeupThread( &queue ); : } } void proc1( void ) { while(1) { : OS_SleepThread( &queue ); : } } void proc2( void ) { while(1) { : OS_SleepThread( &queue ); : } }
OS_InitThread, OS_CreateThread, OS_SleepThread, OS_WakeupThreadDirect
2004/03/12 Changed the description of what happens when there are identical priorities
2003/12/01 Initial version.
CONFIDENTIAL