usleep(3C) DG/UX R4.11MU05 usleep(3C)
NAME
usleep - suspend execution for interval
SYNOPSIS
usleep(useconds)
unsigned useconds;
DESCRIPTION
The current process is suspended from execution for the number of
microseconds specified by the argument. The actual suspension time
may be an arbitrary amount longer because of other activity in the
system or because of the time spent in processing the call.
The routine is implemented by setting an interval timer and pausing
until it occurs. 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.
This routine is implemented using setitimer(2); it requires eight
system calls each time it is invoked. A similar but less compatible
function can be obtained with a single select(2); it would not
restart after signals, but would not interfere with other uses of
setitimer.
Considerations for Threads Programming
+---------+-----------------------------+
| | async- |
|function | reentrant cancel cancel |
| | point safe |
+---------+-----------------------------+
|usleep | Y Y N |
+---------+-----------------------------+
In a threaded application, only the thread issuing the usleep call
suspends for the specified number of seconds. Other threads in the
process are not affected. A threaded process does not use SIGALRM as
do non-threaded processes.
SEE ALSO
alarm(2), getitimer(2), setitimer(2), sigpause(2), reentrant(3),
sleep(3C).
Licensed material--property of copyright holder(s)