high resolution sleep
struct timespec *timeout
() suspends execution of the calling
process for the duration specified by
. An unmasked signal will cause it to
terminate the sleep early, regardless of the
value on the interrupting
() function returns because
the requested duration has elapsed, the value returned will be zero.
() function returns due to
the delivery of a signal, the value returned will be -1, and the global
will be set to indicate the
interruption. If remainder
is non-null, the
timespec structure it references is updated to contain the unslept amount (the
requested duration minus the duration actually slept).
If any of the following conditions occur, the
() function shall return -1 and
to the corresponding value.
nanosleep() was interrupted by the
delivery of a signal.
- timeout specified a nanosecond value less
than zero or greater than 1000 million, or a second value less than zero
or greater than 100 million.
- Either timeout or
remainder points to memory that is not a
valid part of the process address space.
() function conforms to
IEEE Std 1003.1-2008
The predecessor of this system call,
appeared in Version 3 AT&T UNIX
, but was
removed when alarm(3)
introduced into Version 7 AT&T UNIX
() system call has been available
since NetBSD 1.3
and was ported to