Sleeping
A thread can use a sleep operation to yield execution to other threads. The sleep operation is an efficient way to block a thread for some specified minimum period of time. Threads can put only themselves to sleep; one thread cannot force another thread to sleep.
You can use two different functions to put a calling thread to sleep:
void RWRunnableSelf::sleep(unsigned long milliseconds) The RWRunnableSelf::sleep() function can be called by a thread running inside of a runnable object. This function sets the runnable execution state to RW_THR_SLEEPING[14] and then enters a blocking wait until the specified period of time has passed. Once the time-period has elapsed, the thread is unblocked and becomes eligible for execution. The runnable is returned to the RW_THR_RUNNING[15] once the thread begins executing again.
void rwSleep(unsigned long milliseconds) The global rwSleep() function can be called by any thread, regardless of whether or not it originated or is executing within a runnable object. This function is identical to the sleep() function except that it causes no changes in the execution state of a runnable.
Both functions take an unsigned long value that specifies the number of milliseconds that the thread is to sleep. A thread is not guaranteed to resume execution once the sleep time period has elapsed. The thread merely becomes eligible for execution and might have to wait for processing resources to become available.