Commit | Line | Data |
---|---|---|
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 | |
19 | The | |
089ea8fb | 20 | .Fn usleep |
ae59e04c CL |
21 | function |
22 | suspends execution of the calling process | |
23 | for | |
24 | .Fa microseconds | |
25 | of time. | |
26 | System activity or time spent in processing the | |
27 | call may lengthen the sleep slightly. | |
28 | .Pp | |
29 | If a timer is already running on the process its state is saved. | |
30 | If the value | |
31 | .Fa microseconds | |
32 | is more than or equal to the remaining clock time for the saved timer, | |
33 | the sleep time is set to | |
34 | the remaining clock time. | |
35 | The state of the previous timer | |
36 | is restored after | |
37 | .Fa microseconds | |
38 | has passed. | |
39 | .Pp | |
d9d2c099 | 40 | This routine is implemented using |
ae59e04c | 41 | .Xr setitimer 2 ; |
d9d2c099 MK |
42 | it requires eight system calls each time it is invoked. |
43 | A similar but less compatible function can be obtained with a single | |
ae59e04c CL |
44 | .Xr select 2 ; |
45 | such a function would not restart after signals, but would not interfere | |
d9d2c099 | 46 | with 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 | |
56 | The | |
57 | .Fn usleep | |
58 | function appeared in | |
59 | .Bx 4.3 . |