usleep(3) — Subroutines
NAME
usleep − Suspends execution for an interval
LIBRARY
Standard C Library (libc.a)
SYNOPSIS
void usleep(
unsigned mseconds );
PARAMETERS
msecondsThe number of microseconds to suspend execution for.
DESCRIPTION
The usleep() function suspends the current process from execution for the number of microseconds specified by the mseconds parameter. Because of other activity in the system, or because of the time spent in processing the call, the actual suspension time may be longer than specified.
The usleep() function sets an interval timer and pauses until it expires. The previous state of this timer is saved and restored. If the sleep time exceeds the time to the expiration of the previous timer, the process sleeps only until the signal would have occurred, and the signal is sent a short time later.
The usleep() function uses the setitimer() function. It requires eight system calls each time it is invoked. A similar but less compatible function can be obtained with a single select; it would not restart after signals, but would not interfere with other uses of setitimer().
RELATED INFORMATION
Functions: alarm(3), getitimer(2), sigaction(2), sigvec(2), sleep(3)