1*61111Sbostic.\" Copyright (c) 1986, 1991, 1993 2*61111Sbostic.\" The Regents of the University of California. All rights reserved. 320452Smckusick.\" 448352Scael.\" %sccs.include.redist.man% 520452Smckusick.\" 6*61111Sbostic.\" @(#)sleep.3 8.1 (Berkeley) 06/04/93 748352Scael.\" 848352Scael.Dd 948352Scael.Dt SLEEP 3 1048352Scael.Os 1148352Scael.Sh NAME 1248352Scael.Nm sleep 1348352Scael.Nd suspend process execution for interval of seconds 1448352Scael.Sh SYNOPSIS 1548352Scael.Fd #include <unistd.h> 1660227Sbostic.Ft u_int 1748352Scael.Fn sleep "u_int seconds" 1848352Scael.Sh DESCRIPTION 1948352ScaelThe 2048352Scael.Fn sleep 2148352Scaelfunction 2248352Scaelsuspends execution of the calling process 2348352Scaelfor 2448352Scael.Fa seconds 2548352Scaelof time. 2648352ScaelSystem activity or time spent in processing the 2748352Scaelcall may lengthen the sleep by a second. 2848352Scael.Pp 2948352ScaelIf a timer is already running on the process its state is saved. 3048352ScaelIf the value 3148352Scael.Fa seconds 3248352Scaelis more than or equal to the remaining clock time for the saved timer, 3348352Scaelthe sleep time is set to 3448352Scaelthe remaining clock time. 3548352ScaelThe state of the previous timer 3648352Scaelis restored after 3748352Scael.Fa seconds 3848352Scaelhas passed. 3948352Scael.Pp 4048352ScaelThis function is implemented using 4148352Scael.Xr setitimer 2 ; 4248352Scaelit requires eight system calls each time it is invoked. 4348352ScaelA similar but less compatible function can be obtained with a single 4448352Scael.Xr select 2 ; 4548352Scaelsuch a function would not restart after signals, but would not interfere 4648352Scaelwith other uses of 4748352Scael.Xr setitimer . 4848352Scael.Sh RETURN VALUES 4948352Scael.Sh SEE ALSO 5048352Scael.Xr setitimer 2 , 5148352Scael.Xr sigpause 2 , 5248352Scael.Xr usleep 3 5348352Scael.Sh HISTORY 5448352ScaelA 5548352Scael.Fn sleep 5648352Scaelfunction appeared in 5748352Scael.At v7 . 58