SLEEP(3C) DOMAIN/IX SYS5 SLEEP(3C)
NAME
sleep - suspend execution for interval
USAGE
unsigned sleep (seconds)
unsigned seconds;
DESCRIPTION
Sleep suspends execution of the current process for the
number of seconds specified by the argument. The actual
time may be less than the requested time because:
⊕ scheduled wakeups occur at fixed 1-second intervals, (on
the second, according to an internal clock)
⊕ any caught signal will terminate the sleep following exe-
cution of that signal's catching routine. The the
suspension time may also be longer than requested, due to
the scheduling of other activity in the system.
The value returned by sleep will be 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 in case another caught sig-
nal terminated sleep prematurely.
The routine is implemented by setting an alarm signal and
pausing until it (or some other signal) occurs. The previ-
ous state of the alarm signal is saved and restored. The
calling program may set up an alarm signal before calling
sleep. If the sleep time exceeds the time till such an
alarm signal, the process sleeps only until the alarm signal
would have occurred. The caller's alarm catch routine is
executed just before the sleep routine returns. But if the
sleep time is less than the time till such an alarm, the
prior alarm time is reset to go off at the same time it
would have without the intervening sleep.
RELATED INFORMATION
alarm(2), pause(2), signal(2)
Printed 12/4/86 SLEEP-1