1.\" Copyright (c) 1986, 1991 Regents of the University of California. 2.\" All rights reserved. 3.\" 4.\" %sccs.include.redist.man% 5.\" 6.\" @(#)sleep.3 6.3 (Berkeley) 04/19/91 7.\" 8.Dd 9.Dt SLEEP 3 10.Os 11.Sh NAME 12.Nm sleep 13.Nd suspend process execution for interval of seconds 14.Sh SYNOPSIS 15.Fd #include <unistd.h> 16.Ft int 17.Fn sleep "u_int seconds" 18.Sh DESCRIPTION 19The 20.Fn sleep 21function 22suspends execution of the calling process 23for 24.Fa seconds 25of time. 26System activity or time spent in processing the 27call may lengthen the sleep by a second. 28.Pp 29If a timer is already running on the process its state is saved. 30If the value 31.Fa seconds 32is more than or equal to the remaining clock time for the saved timer, 33the sleep time is set to 34the remaining clock time. 35The state of the previous timer 36is restored after 37.Fa seconds 38has passed. 39.Pp 40This function is implemented using 41.Xr setitimer 2 ; 42it requires eight system calls each time it is invoked. 43A similar but less compatible function can be obtained with a single 44.Xr select 2 ; 45such a function would not restart after signals, but would not interfere 46with other uses of 47.Xr setitimer . 48.Sh RETURN VALUES 49.Sh SEE ALSO 50.Xr setitimer 2 , 51.Xr sigpause 2 , 52.Xr usleep 3 53.Sh HISTORY 54A 55.Fn sleep 56function appeared in 57.At v7 . 58