Training
×

Low Level Sleep Timer

Puts the calling thread to sleep for the specified number of system timer ticks. Unlike RtSleep with its granularity of 10ms, knRtSleep is based on the system timer ticks. The system timer ticks can be configured, default is 500 microseconds. See the chapter on timers for a comparison between alarms vs. (kn)RtSleep.
The macro US_TO_KTICKS may be used to convert a value in microseconds to a system timer tick count.
There are two special values for dwKernelTicks, KN_DONT_WAIT and KN_WAIT_FOREVER.
Use KN_DONT_WAIT if the calling thread should not wait but only allow the other ready threads of equal priority to execute. If there are no other ready threads of equal priority, the current thread remains running.
KN_WAIT_FOREVER causes the thread to sleep forever. This is like deleting the thread, but the thread's memory is not released. Thus, local variables and other memory references of the thread can still be accessed which may be useful in debugging or diagnostic situations.