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 11, 2021 29*cc697d22SBrooks Davis.Dt USLEEP 3 30*cc697d22SBrooks Davis.Os 31*cc697d22SBrooks Davis.Sh NAME 32*cc697d22SBrooks Davis.Nm usleep 33*cc697d22SBrooks Davis.Nd suspend thread execution for an interval measured in microseconds 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 int 39*cc697d22SBrooks Davis.Fn usleep "useconds_t microseconds" 40*cc697d22SBrooks Davis.Sh DESCRIPTION 41*cc697d22SBrooks DavisThe 42*cc697d22SBrooks Davis.Fn usleep 43*cc697d22SBrooks Davisfunction suspends execution of the calling thread until either 44*cc697d22SBrooks Davis.Fa microseconds 45*cc697d22SBrooks Davismicroseconds 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 Davisprocess. 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 microseconds 54*cc697d22SBrooks Davismicroseconds 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 Davis.Rv -std usleep 60*cc697d22SBrooks Davis.Sh ERRORS 61*cc697d22SBrooks DavisThe 62*cc697d22SBrooks Davis.Fn usleep 63*cc697d22SBrooks Davisfunction 64*cc697d22SBrooks Daviswill fail if: 65*cc697d22SBrooks Davis.Bl -tag -width Er 66*cc697d22SBrooks Davis.It Bq Er EINTR 67*cc697d22SBrooks DavisA signal was delivered to the calling thread and its 68*cc697d22SBrooks Davisaction was to invoke a signal-catching function. 69*cc697d22SBrooks Davis.El 70*cc697d22SBrooks Davis.Sh SEE ALSO 71*cc697d22SBrooks Davis.Xr nanosleep 2 , 72*cc697d22SBrooks Davis.Xr sleep 3 73*cc697d22SBrooks Davis.Sh HISTORY 74*cc697d22SBrooks DavisThe 75*cc697d22SBrooks Davis.Fn usleep 76*cc697d22SBrooks Davisfunction appeared in 77*cc697d22SBrooks Davis.Bx 4.3 . 78