usleep(S)
usleep --
suspend execution for an interval
Syntax
cc . . . -lc
#include <unistd.h>
int usleep(useconds_t useconds);
Description
The usleep function suspends the current process from
execution for the number of microseconds specified by the
useconds argument. Because of other activity, or because
of the time spent processing the call, the process may be suspended
for longer than specified in useconds.
useconds must be less than one million; if the value is 0,
the call has no effect.
usleep uses the process' realtime interval timer to
indicate to the system when the process should be awakened. There is
one realtime interval timer per process. Previous settings of the
timer are not affected by calls to usleep. If the process
has the timer prior to calling usleep, and if the value
specified in useconds equals or exceeds the timer's prior
setting, the process is awakened just before the timer was set to
expire.
Note that it is recommended that the
setitimer(S)
function be used instead of usleep: usleep is
supplied for historical reasons.
Return values
Upon successful completion, usleep returns 0. Otherwise,
-1 is returned and errno is set to indicate the error.
Diagnostics
If the following error condition occurs, usleep returns
-1 and sets errno to the corresponding value:
[EINVAL]-
The useconds argument was set to a value equal to or
greater than one million.
See also
alarm(S),
getitimer(S),
sigaction(S),
sleep(S)
Standards conformance
usleep is conformant with:
X/Open Portability Guide Issue 4, Version 2 (Spec-1170).
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003