NANOSLEEP(2) NANOSLEEP(2)
NAME
nanosleep - high resolution sleep
C SYNOPSIS
#include <time.h>
int nanosleep(const struct timespec *rqtp, struct timespec *rmtp);
DESCRIPTION
The nanosleep system call causes the current thread to suspend until
either the time interval specified by the rqtp argument has elapsed or a
signal is delivered to the calling thread and its action is to invoke a
signal-handling function or terminate the process.
The suspension time will be rounded to a multiple of the underlying
system-provided sleep resolution. On Onyx/Challenge systems this
resolution is defined by the variable fasthz which may be examined or
modified using systune(1M). On other platforms, the resolution is
determined by fasthz for realtime processes and by the length of a clock
tick for non-realtime processes. The length of a clock tick is defined
by CLKTCK in the include file <limits.h>. This is the same for all
IRIS-4D products.
SEE ALSO
sleep(3), sginap(2), alarm(2), pause(2), schedctl(2), timers(5),
realtime(5).
DIAGNOSTICS
If the calling thread remains suspended for the requested time interval,
nanosleep returns 0. If, however, the thread is interrupted prematurely
by a signal, it returns -1 and sets errno to indicate the interruption.
If the rmtp argument is non-NULL, the timespec structure referenced by it
contains the amount of time remaining in the interval.
If any of the following conditions occur, nanosleep returns -1 and sets
errno to indicate the error:
[EFAULT] An argument address referenced invalid memory.
[EINTR] nanosleep was interrupted by a signal.
[EINVAL] The rqtp argument specified a nanosecond value less than
zero or greater than
or equal to 1000 million.
Page 1