Open System Services Library Calls Reference Manual (G06.27+, H06.04+)
OSS Library Calls (t - v) usleep(3)
RETURN VALUES
If the usleep() function returns because the requested time has elapsed, the value 0 (zero) is
returned. If the usleep() function returns because a signal was caught, the number of
microseconds still remaining when the signal was delivered is returned. If the function call fails,
the value -1 is returned and errno is set to indicate the error.
ERRORS
If the following condition occurs, the usleep() function sets errno to the corresponding value:
[EINVAL] The value specified for the useconds parameter was greater than 1000000.
If a signal is received via pthread_kill(2) that is not blocked, ignored, or handled, -1 is returned
with an errno of EINTR.
RELATED INFORMATION
Functions: alarm(3), pause(3), sigaction(2). sleep(3).
STANDARDS CONFORMANCE
The POSIX standards leave some features to the implementing vendor to define. The following
features are affected in the HP implementation:
• The SIGALRM signal does not terminate the usleep() function if the signal is blocked
or ignored.
• A blocked SIGALRM signal remains pending once the usleep() function returns.
• A SIGALRM signal that is not blocked or ignored causes the usleep() function to
return. Upon return, the signal is delivered immediately.
• A signal-catching function that interrupts the usleep() function can examine or change
the time in which a SIGALRM signal is generated. Such actions have no effect on the
behavior of the usleep() function. The newly scheduled signal is not affected by the
return from the usleep() function.
• The effect of a SIGALRM signal is not changed if the process exits a usleep() function
call by using the siglongjmp() or longjmp() function. Whether the signal is blocked
depends on the value of the signal mask when the corresponding sigsetjmp() function
was called.
527187-004 Hewlett-Packard Company 7−59