Open System Services Library Calls Reference Manual (G06.28+, H06.05+)
sleep(3) OSS Library Calls Reference Manual
NAME
sleep - Suspends execution for an interval
LIBRARY
G-series native OSS processes: system library
H-series OSS processes: implicit libraries
SYNOPSIS
#include <unistd.h>
unsigned int sleep(
unsigned int seconds);
PARAMETERS
seconds Specifies the number of seconds to suspend execution. A value greater than the
system maximum of 0x7FFFFFFF one-hundredths of a second is reduced to the
system maximum without informing the caller.
DESCRIPTION
The sleep() function suspends the calling process until one of the following occurs:
• The specified number of seconds elapses.
• A signal is delivered to the process and the action of that signal is either to execute a
signal-catching function or to terminate the process.
The suspension time might be longer than requested due to the scheduling of other higher-
priority processes in the system.
Use From the Guardian Environment
The actions of this function are undefined if it is called from a TNS or accelerated Guardian pro-
cess or from any privileged process.
Effects of SIGALRM
The SIGALRM signal does not affect the sleep() function any differently from any other signal.
However, because in some implementations there is a dependency between SIGALRM and
sleep(), it is appropriate to discuss SIGALRM here.
If a SIGALRM signal is generated for the calling process during execution of the sleep() func-
tion, and if the SIGALRM signal is being ignored or blocked from delivery, the sleep() function
does not return. If the signal is being blocked, it remains pending when the function returns.
If a SIGALRM signal is generated for the calling process during execution of the sleep() func-
tion, except as a result of a prior call to the alarm() function, and if the SIGALRM signal is not
being ignored or blocked from delivery, the signal has no effect other than to cause 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() func-
tion.
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.
6−54 Hewlett-Packard Company 527187-007