Suspend a thread until a timeout or signal occurs
#include <time.h> int nanosleep( const struct timespec* rqtp, struct timespec* rmtp );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The nanosleep() function causes the calling thread to be suspended from execution until either:
Or
The suspension time may be longer than requested because the argument value is rounded up to be a multiple of the system timer resolution (see the Tick, Tock: Understanding the Neutrino Microkernel's Concept of Time chapter of the QNX Neutrino Programmer's Guide) or because of scheduling and other system activity. |
Safety: | |
---|---|
Cancellation point | Yes |
Interrupt handler | No |
Signal handler | No |
Thread | Yes |
delay, errno, clock_getres(), clock_gettime(), clock_settime(), sleep(), timer_create(), timer_delete(), timer_gettime(), timer_settime(), timespec, usleep()