1*cc697d22SBrooks Davis.\" Copyright (c) 1986, 1991, 1993 2*cc697d22SBrooks Davis.\" The Regents of the University of California. All rights reserved. 3*cc697d22SBrooks Davis.\" 4*cc697d22SBrooks Davis.\" Redistribution and use in source and binary forms, with or without 5*cc697d22SBrooks Davis.\" modification, are permitted provided that the following conditions 6*cc697d22SBrooks Davis.\" are met: 7*cc697d22SBrooks Davis.\" 1. Redistributions of source code must retain the above copyright 8*cc697d22SBrooks Davis.\" notice, this list of conditions and the following disclaimer. 9*cc697d22SBrooks Davis.\" 2. Redistributions in binary form must reproduce the above copyright 10*cc697d22SBrooks Davis.\" notice, this list of conditions and the following disclaimer in the 11*cc697d22SBrooks Davis.\" documentation and/or other materials provided with the distribution. 12*cc697d22SBrooks Davis.\" 3. Neither the name of the University nor the names of its contributors 13*cc697d22SBrooks Davis.\" may be used to endorse or promote products derived from this software 14*cc697d22SBrooks Davis.\" without specific prior written permission. 15*cc697d22SBrooks Davis.\" 16*cc697d22SBrooks Davis.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 17*cc697d22SBrooks Davis.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 18*cc697d22SBrooks Davis.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 19*cc697d22SBrooks Davis.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 20*cc697d22SBrooks Davis.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21*cc697d22SBrooks Davis.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 22*cc697d22SBrooks Davis.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 23*cc697d22SBrooks Davis.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24*cc697d22SBrooks Davis.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25*cc697d22SBrooks Davis.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26*cc697d22SBrooks Davis.\" SUCH DAMAGE. 27*cc697d22SBrooks Davis.\" 28*cc697d22SBrooks Davis.Dd February 13, 1998 29*cc697d22SBrooks Davis.Dt SLEEP 3 30*cc697d22SBrooks Davis.Os 31*cc697d22SBrooks Davis.Sh NAME 32*cc697d22SBrooks Davis.Nm sleep 33*cc697d22SBrooks Davis.Nd suspend thread execution for an interval measured in seconds 34*cc697d22SBrooks Davis.Sh LIBRARY 35*cc697d22SBrooks Davis.Lb libc 36*cc697d22SBrooks Davis.Sh SYNOPSIS 37*cc697d22SBrooks Davis.In unistd.h 38*cc697d22SBrooks Davis.Ft unsigned int 39*cc697d22SBrooks Davis.Fn sleep "unsigned int seconds" 40*cc697d22SBrooks Davis.Sh DESCRIPTION 41*cc697d22SBrooks DavisThe 42*cc697d22SBrooks Davis.Fn sleep 43*cc697d22SBrooks Davisfunction suspends execution of the calling thread until either 44*cc697d22SBrooks Davis.Fa seconds 45*cc697d22SBrooks Davisseconds have elapsed or a signal is delivered to the thread and its 46*cc697d22SBrooks Davisaction is to invoke a signal-catching function or to terminate the 47*cc697d22SBrooks Davisthread or process. 48*cc697d22SBrooks DavisSystem activity may lengthen the sleep by an indeterminate amount. 49*cc697d22SBrooks Davis.Pp 50*cc697d22SBrooks DavisThis function is implemented using 51*cc697d22SBrooks Davis.Xr nanosleep 2 52*cc697d22SBrooks Davisby pausing for 53*cc697d22SBrooks Davis.Fa seconds 54*cc697d22SBrooks Davisseconds or until a signal occurs. 55*cc697d22SBrooks DavisConsequently, in this implementation, 56*cc697d22SBrooks Davissleeping has no effect on the state of process timers, 57*cc697d22SBrooks Davisand there is no special handling for SIGALRM. 58*cc697d22SBrooks Davis.Sh RETURN VALUES 59*cc697d22SBrooks DavisIf the 60*cc697d22SBrooks Davis.Fn sleep 61*cc697d22SBrooks Davisfunction returns because the requested time has elapsed, the value 62*cc697d22SBrooks Davisreturned will be zero. 63*cc697d22SBrooks DavisIf the 64*cc697d22SBrooks Davis.Fn sleep 65*cc697d22SBrooks Davisfunction returns due to the delivery of a signal, the value returned 66*cc697d22SBrooks Daviswill be the unslept amount (the requested time minus the time actually 67*cc697d22SBrooks Davisslept) in seconds. 68*cc697d22SBrooks Davis.Sh SEE ALSO 69*cc697d22SBrooks Davis.Xr nanosleep 2 , 70*cc697d22SBrooks Davis.Xr usleep 3 71*cc697d22SBrooks Davis.Sh STANDARDS 72*cc697d22SBrooks DavisThe 73*cc697d22SBrooks Davis.Fn sleep 74*cc697d22SBrooks Davisfunction conforms to 75*cc697d22SBrooks Davis.St -p1003.1-90 . 76*cc697d22SBrooks Davis.Sh HISTORY 77*cc697d22SBrooks DavisA 78*cc697d22SBrooks Davis.Fn sleep 79*cc697d22SBrooks Davisfunction appeared in 80*cc697d22SBrooks Davis.At v7 . 81