SLEEP(3C) UNIX Programmer's Manual SLEEP(3C) NAME sleep - suspend execution for interval SYNOPSIS unsigned long sleep (seconds) unsigned long seconds; HP-UX COMPATIBILITY Level: HP-UX/RUN ONLY Origin: System III DESCRIPTION The current process is suspended from execution for the number of _s_e_c_o_n_d_s specified by the argument. The actual suspension time may be less than that requested for two rea- sons: (1) Because scheduled wakeups occur at fixed 1-second intervals, and (2) because any caught signal will terminate the _s_l_e_e_p following execution of that signal's catching rou- tine. Also, 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 _s_l_e_e_p 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 _s_l_e_e_p time, or 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 previ- ous state of the alarm signal is saved and restored. The calling program may have set up an alarm signal before cal- ling _s_l_e_e_p. If the _s_l_e_e_p time exceeds the time till such an alarm signal, the process sleeps only until the alarm signal would have occurred, and the caller's alarm catching routine is executed just before the _s_l_e_e_p routine returns. If the _s_l_e_e_p 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 _s_l_e_e_p. _S_e_c_o_n_d_s must be less than 2^32. SEE ALSO alarm(2), pause(2), signal(2).