usleep - suspend execution for interval of microseconds
The usleep() function suspends execution of the calling process for
microseconds microseconds of time. System activity or time
spent in processing
the call may lengthen the sleep slightly.
This routine is implemented using nanosleep(2); it requires
call each time it is invoked. A similar but less compatible
be obtained with a single select(2); such a function would
after signals, and also does not interfere with other uses
setitimer(2) (not that usleep() interferes with interval
If the usleep() function returns because the requested time
the value returned will be zero.
If the usleep() function returns due to the delivery of a
value returned will be -1, and the global variable errno
will be set to
indicate the interruption.
If any of the following conditions occur, the usleep() function shall return
-1 and set errno to the corresponding value.
[EINTR] usleep() was interrupted by the delivery of a
[EINVAL] useconds specified a value of 1,000,000 or
A microsecond is 0.000001 seconds.
getitimer(2), nanosleep(2), setitimer(2), alarm(3), sigpause(3),
The usleep() function conforms to X/Open Portability Guide
The usleep() function appeared in 4.3BSD.
OpenBSD 3.6 November 4, 1997
[ Back ]