HP-UX Reference (11i v1 00/12) - 3 Library Functions N-Z (vol 7)
__________________________________________________________________________________________________________________________________________________________________________________________________
__________________________________________________________________________________________________________________________________________________________________________________________________
STANDARD Printed by: Nora Chuang [nchuang] STANDARD
/build/1111/BRICK/man3/nan.3m
________________________________________________________________
___ ___
s
sleep(3C) sleep(3C)
NAME
sleep() - suspend execution for interval
SYNOPSIS
#include <unistd.h>
unsigned int sleep(unsigned int seconds);
DESCRIPTION
sleep() suspends the current process from execution for the number of seconds specified by the argu-
ment.
Actual suspension time can be less than that requested for two reasons:
• Scheduled wakeups occur at fixed 1-second intervals (on the second, according to an internal clock),
and
• Any caught signal terminates the sleep following execution of that signal’s catching routine.
Suspension time can be an arbitrary amount longer than requested due to the scheduling of other activity
in the system. The value returned by sleep()
is the ‘‘unslept’’ amount (the requested time minus the
time actually slept) in case the caller had an alarm set to go off earlier than the end of the requested
sleep() time, or premature arousal due to another caught signal.
seconds must be less than 2
32
.
APPLICATION USAGE
sleep() is thread-safe. It is not async-cancel-safe. A cancellation point may occur when a thread is exe-
cuting sleep().
If a SIGALRM is generated for a multi-threaded process, it may not be delivered to a thread currently in
sleep(). See sigwait(2) man page for details. In a multi-threaded process delivery of a SIGALRM to a
thread in sleep() simply causes sleep() to return without invoking the SIGALRM handler.
SEE ALSO
sigwait(2), signal(5).
STANDARDS CONFORMANCE
sleep(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1
HP-UX Release 11i: December 2000 − 1 − Section 3−−865
___
___