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_Sleep</TITLE> 8<LINK rel="stylesheet" href="../../css/nitro.css" type="text/css"> 9</HEAD> 10<BODY> 11<H1 align="left">OS_Sleep <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_Sleep( u32 msec ); 17</CODE></PRE> 18</DL> 19<H2>Arguments</H2> 20<TABLE border="1" width="100%"> 21 <TBODY> 22 <TR> 23 <TD width="13%"><EM><STRONG>msec</STRONG></EM></TD> 24 <TD width="87%">Time in sleep status (milliseconds)</TD> 25 </TR> 26 </TBODY> 27</TABLE> 28<H2>Return Values</H2> 29<P>None.</P> 30<H2>Description</H2> 31<P>Stops the thread for a specified time.</P> 32<P>Sleep time for the thread in milliseconds.</P> 33<P>An internal alarm is set so that the alarm handler will go off after the specified time to put the thread to sleep. The alarm handler will attempt to wake up the thread. Therefore, the tick system and alarm system need to be initialized using <CODE><A href="../time/OS_InitTick.html">OS_InitTick()</A></CODE> and <CODE><A href="../alarm/OS_InitAlarm.html">OS_InitAlarm()</A></CODE> as well as <CODE><A href="OS_InitThread.html">OS_InitThread()</A></CODE> in advance.</P> 34<P>If a sleeping thread has been destroyed by <CODE><A href="OS_KillThread.html">OS_KillThread*()</A></CODE> or <CODE><A href="OS_DestroyThread.html">OS_DestroyThread()</A></CODE>, the internal alarm set to wake up that sleeping thread will be canceled.</P> 35<H2>See Also</H2> 36<P><CODE><A href="OS_InitThread.html">OS_InitThread</A>, <A href="../time/OS_InitTick.html">OS_InitTick</A>, 37 <A href="../alarm/OS_InitAlarm.html">OS_InitAlarm</A>, <A href="OS_SleepThread.html">OS_SleepThread</A></CODE><BR> <CODE><A href="OS_KIllThread.html">OS_KillThread*</A>, <A href="OS_DestroyThread.html">OS_DestroyThread</A></CODE></P> 38<H2>Revision History</H2> 39<P>2005/08/08 Added a description of what happens when a sleeping thread is destroyed by another thread.<BR>2004/03/02 Initial version.</P> 40<hr><p>CONFIDENTIAL</p></body> 41</HTML>