1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 2<HTML> 3<HEAD> 4<META http-equiv="Content-Type" content="text/html; charset=windows-1252"> 5<META name="GENERATOR" content="IBM WebSphere Studio Homepage Builder Version 7.0.0.0 for Windows"> 6<META http-equiv="Content-Style-Type" content="text/css"> 7<TITLE>OS_WakeupThread</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">OS_WakeupThread <IMG src="../../image/NTR.gif" align="middle"><IMG src="../../image/TWL.gif" align="middle"></H1> 12<H2>Syntax</H2> 13<DL> 14 <DD> 15 <PRE><CODE>#include <nitro/os.h></CODE></PRE> 16 <PRE><CODE>void OS_WakeupThread( OSThreadQueue* queue );</CODE></PRE> 17</DL> 18<H2>Arguments</H2> 19<TABLE border="1" width="100%"> 20 <TBODY> 21 <TR> 22 <TD width="13%"><EM><STRONG>queue</STRONG></EM></TD> 23 <TD width="87%">Pointer to the thread queue where the thread to be recovered is registered.</TD> 24 </TR> 25 </TBODY> 26</TABLE> 27<H2>Return Values</H2> 28<P>None.</P> 29<H2>Description</H2> 30<P>Recovers all threads in the specified thread queue.<BR>This function recovers all threads from within the thread queue designated with <B><I>queue</I></B> that were paused by <CODE><A href="OS_SleepThread.html">OS_SleepThread()</A></CODE>. After this the threads are scheduled based on priority. Priority was assigned when the thread was created with <A href="OS_CreateThread.html"><CODE>OS_CreateThread()</CODE></A>, 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.</P> 31<P>The following is an example of using <CODE>OS_WakeupThread()</CODE>.</P> 32 33<BLOCKQUOTE>Example:<BR> 34<PRE>#define THREAD1_PRIO 1 35#define THREAD2_PRIO 2 36#define STACK_SIZE 1024 37void proc1( void ); 38void proc2( void ); 39OSThread thread1; 40OSThread thread2; 41OSThreadQueue queue; 42u64 stack1[ STACK_SIZE / sizeof(u64) ]; 43u64 stack2[ STACK_SIZE / sizeof(u64) ]; 44 45void nitroMain() 46{ 47 : 48 OS_InitThread(); 49 <FONT color="#ff0000">OS_InitThreadQueue( &queue );</FONT> 50 OS_CreateThread( &thread1, proc1, stack1+STACK_SIZE/sizeof(u64), 51 STACK_SIZE, THREAD1_PRIO ); 52 OS_CreateThread( &thread2, proc2, stack2+STACK_SIZE/sizeof(u64), 53 STACK_SIZE, THREAD2_PRIO ); 54 OS_WakeupThreadDirect( &thread1 ); 55 OS_WakeupThreadDirect( &thread2 ); 56 : 57 while(1) 58 { 59 : 60 <FONT color="#ff0000">OS_WakeupThread( &queue );</FONT> 61 : 62 } 63} 64 65void proc1( void ) 66{ 67 while(1) 68 { 69 : 70 <FONT color="#ff0000">OS_SleepThread( &queue );</FONT> 71 : 72 } 73} 74 75void proc2( void ) 76{ 77 while(1) 78 { 79 : 80 <FONT color="#ff0000">OS_SleepThread( &queue );</FONT> 81 : 82 } 83}</PRE></BLOCKQUOTE> 84 85<H2>See Also</H2> 86<P><CODE><A href="OS_InitThread.html">OS_InitThread</A>, <A href="OS_CreateThread.html">OS_CreateThread</A>, <A href="OS_SleepThread.html">OS_SleepThread</A>, <A href="OS_WakeupThreadDirect.html">OS_WakeupThreadDirect</A><BR></CODE></P> 87<H2>Revision History</H2> 88<P>2004/03/12 Changed the description of what happens when there are identical priorities <BR>2003/12/01 Initial version.</P> 89<hr><p>CONFIDENTIAL</p></body> 90</HTML>