Commit | Line | Data |
---|---|---|
cb026509 KM |
1 | .\" Copyright (c) 1980 Regents of the University of California. |
2 | .\" All rights reserved. The Berkeley software License Agreement | |
3 | .\" specifies the terms and conditions for redistribution. | |
4 | .\" | |
d9d2c099 | 5 | .\" @(#)@(#)usleep.3 6.3 (Berkeley) %G% |
cb026509 KM |
6 | .\" |
7 | .TH USLEEP 3 "" | |
8 | .UC 6 | |
9 | .SH NAME | |
10 | usleep \- suspend execution for interval | |
11 | .SH SYNOPSIS | |
12 | .nf | |
13 | .B usleep(useconds) | |
14 | .B unsigned useconds; | |
15 | .fi | |
16 | .SH DESCRIPTION | |
17 | The current process is suspended from execution for the number | |
18 | of microseconds specified by the argument. | |
19 | The actual suspension time may be an arbitrary amount longer | |
d9d2c099 MK |
20 | because of other activity in the system |
21 | or because of the time spent in processing the call. | |
cb026509 KM |
22 | .PP |
23 | The routine is implemented by setting an interval timer | |
24 | and pausing until it occurs. | |
25 | The previous state of this timer is saved and restored. | |
26 | If the sleep time exceeds the time to the expiration of the | |
27 | previous timer, | |
28 | the process sleeps only until the signal would have occurred, and the | |
d9d2c099 MK |
29 | signal is sent a short time later. |
30 | .PP | |
31 | This routine is implemented using | |
32 | .IR setitimer (2); | |
33 | it requires eight system calls each time it is invoked. | |
34 | A similar but less compatible function can be obtained with a single | |
35 | .IR select (2); | |
36 | it would not restart after signals, but would not interfere | |
37 | with other uses of | |
38 | .IR setitimer . | |
cb026509 KM |
39 | .SH "SEE ALSO" |
40 | setitimer(2), getitimer(2), sigpause(2), ualarm(3), sleep(3), alarm(3) |