Open System Services Library Calls Reference Manual (G06.29+, H06.08+, J06.03+)
sleep(3) OSS Library Calls Reference Manual
NAME
sleep - Suspends execution for an interval
LIBRARY
G-series native OSS processes: system library
H-series and J-series OSS processes: implicit libraries
32-bit H-series and J-series OSS processes that use the POSIX User Thread Model library: |
/G/system/zdllnnn/zputdll
64-bit H-series and J-series OSS processes that use the POSIX User Thread Model library: |
/G/system/zdllnnn/yputdll
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 a Threaded Application
The thread-aware sleep( ) function suspends a thread for a specified number of seconds. A certain
amount of delay can be expected in the processing of the thread-aware sleep( ) call because of
other processor-intensive or input/output-intensive threads. If an unblocked signal is received
during this suspension period, thread-aware sleep( ) returns control immediately and returns the
sleep time remaining.
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
6−72 Hewlett-Packard Company 527187-017