Open System Services Library Calls Reference Manual (G06.27+, H06.04+)
OSS Library Calls (s) sleep(3)
RETURN VALUES
If the sleep() function returns because the requested time has elapsed, the value 0 (zero) is
returned. If the sleep() function returns because a signal was caught, the number of seconds still
remaining when the signal was delivered is returned.
ERRORS
If a signal is received via pthread_kill() and is not blocked, ignored, or handled, EOF is returned
with an errno of EINTR.
RELATED INFORMATION
Functions: alarm(3), pause(3), sigaction(2), usleep(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 sleep() function if the signal is blocked or
ignored.
• A blocked SIGALRM signal remains pending once the sleep() function returns.
• A SIGALRM signal that is not blocked or ignored causes the sleep() function to return.
Upon return, the signal is delivered immediately.
• A signal-catching function that interrupts the sleep() function can examine or change the
time in which a SIGALRM signal is generated. Such actions have no effect on the
behavior of the sleep() function. The newly scheduled signal is not affected by the return
from the sleep() function.
• The effect of a SIGALRM signal is not changed if the process exits a sleep() 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 6−51