[Previous]
[Contents]
[Next]

nanosleep()

suspend process until a timeout or signal

Synopsis:

#include <sys/time.h>
int nanosleep( struct timespec *rqtp,
               struct timespec *rmtp );

Description:

The nanosleep() function causes the calling process to be suspended from execution until either

The suspension time may be longer than requested because the argument value is rounded up to be a multiple of the system timer resolution or because of scheduling and other system activity.

Returns:

If the nanosleep() function returns because the requested time has elapsed, its return value is zero. If it was interrupted by a signal, -1 is returned and errno is set.

If the rmtp argument is non-NULL, the timespec structure referenced by it is updated to contain the amount of time remaining in the interval (the requested time minus the time actually slept).

Errors:

EAGAIN
All timers are in use. You'll have to wait for a process to release one.
EINTR
The nanosleep() function was interrupted by a signal.

Classification:

POSIX 1003.4

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

errno, clock_getres(), clock_gettime(), clock_setres(), clock_settime(), sleep(), timer_create(), timer_delete(), timer_gettime(), timer_settime(), ticksize utility


[Previous]
[Contents]
[Next]