per-process limits are resources, not sysctl(3) variables
[unix-history] / usr / src / lib / libc / gen / usleep.3
CommitLineData
ae59e04c
CL
1.\" Copyright (c) 1986, 1991 Regents of the University of California.
2.\" All rights reserved.
cb026509 3.\"
ae59e04c 4.\" %sccs.include.redist.man%
cb026509 5.\"
089ea8fb 6.\" @(#)usleep.3 6.5 (Berkeley) %G%
ae59e04c
CL
7.\"
8.Dd
9.Dt USLEEP 3
10.Os BSD 4.3
11.Sh NAME
12.Nm usleep
13.Nd suspend execution for interval of microseconds
14.Sh SYNOPSIS
15.Fd #include <unistd.h>
16.Ft void
17.Fn usleep "u_int microseconds"
18.Sh DESCRIPTION
19The
089ea8fb 20.Fn usleep
ae59e04c
CL
21function
22suspends execution of the calling process
23for
24.Fa microseconds
25of time.
26System activity or time spent in processing the
27call may lengthen the sleep slightly.
28.Pp
29If a timer is already running on the process its state is saved.
30If the value
31.Fa microseconds
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 microseconds
38has passed.
39.Pp
d9d2c099 40This routine is implemented using
ae59e04c 41.Xr setitimer 2 ;
d9d2c099
MK
42it requires eight system calls each time it is invoked.
43A similar but less compatible function can be obtained with a single
ae59e04c
CL
44.Xr select 2 ;
45such a function would not restart after signals, but would not interfere
d9d2c099 46with other uses of
ae59e04c
CL
47.Xr setitimer .
48.Sh SEE ALSO
49.Xr setitimer 2 ,
50.Xr getitimer 2 ,
51.Xr sigpause 2 ,
52.Xr ualarm 3 ,
53.Xr sleep 3 ,
54.Xr alarm 3
55.Sh HISTORY
56The
57.Fn usleep
58function appeared in
59.Bx 4.3 .