# OS_Sleep

## C Specification

      #include <nitro/os.h>

      void OS_Sleep( u32 msec );

## Arguments

msec | Time in sleep status (milliseconds)

## Return Values

None.

## Description

Stops the thread for a specified time.

Sleep time for the thread in milliseconds.

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 `OS_InitTick()` and `OS_InitAlarm()` as well as ``OS_InitThread()` in advance.`

If a sleeping thread has been destroyed by `OS_KillThread*()` or `OS_DestroyThread()`, the internal alarm set to wake up that sleeping thread will be canceled.

## See Also

`OS_InitThread, OS_InitTick, OS_InitAlarm, OS_SleepThread`
`OS_KillThread*, OS_DestroyThread`

## Revision History

08/08/2005 Added a description of what happens when a sleeping thread is destroyed by another thread.
03/02/2004 Initial version.