sleep(3C) sleep(3C)
NAME
sleep - suspend execution for interval
SYNOPSIS
unsigned sleep (seconds)
unsigned seconds;
DESCRIPTION
sleep suspends the current process from execution for the
number of seconds specified by the argument. The actual
suspension time may be less than that requested for two
reasons: (1) scheduled wakeups occur at fixed 1-second
intervals, (on the second, according to an internal clock)
and (2) any caught signal will terminate sleep following
execution of the signal catching routine. The suspension
time may be longer than requested by an arbitrary amount,
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 in case there is premature
arousal due to another caught signal.
The routine is implemented by setting an alarm signal and
pausing until it (or some other signal) occurs. The
previous state of the alarm signal is saved and restored.
The calling program may have set up an alarm signal before
calling sleep. If the sleep time exceeds the time before
the alarm signal, the process sleeps only until the alarm
signal would have occurred and the caller's alarm catch
routine is executed just before the sleep routine returns.
If the sleep time is less than the time before the calling
program's alarm, the prior alarm time is reset to go off at
the same time it would have without the intervening sleep.
SEE ALSO
alarm(2), pause(2), signal(3).
Page 1 (last mod. 1/14/87)