1SLEEP(3)                   Library Functions Manual                   SLEEP(3)
2
3
4

NAME

6       sleep, usleep - suspend process execution
7

SYNOPSIS

9       #include <unistd.h>
10
11       unsigned int
12       sleep(seconds)
13             unsigned int seconds;
14
15       void
16       usleep(microseconds)
17              long microseconds;
18

DESCRIPTION

20       The  sleep  function suspends execution of the calling process for sec‐
21       onds of clock time, or until interrupted by a signal.
22
23       The usleep function suspends  execution  of  the  calling  process  for
24       microseconds of clock time, or until interrupted by a signal.
25
26       System activity may lengthen the suspension.
27

RETURN VALUES

29       The  sleep  function  returns  0, or if interrupted before seconds, the
30       amount not slept (the requested time minus the time actually slept)  in
31       seconds.  The usleep function does not return anything (meaningful).
32

SEE ALSO

34       select(2)
35

COMPATIBILITY

37       Previous  implementations  of sleep and usleep re-suspended the process
38       if interrupted by a signal.  This implementation has  been  changed  to
39       return in that case, to conform to POSIX 1003.1-88.
40
41       On  the PDP-11 the previous version of usleep took a u_int as the input
42       parameter.  This has been changed to be long so that usleep can be used
43       for more than 65 milliseconds (a u_int could only count 65535 microsec‐
44       onds) of sleep.  Thus it is now possible for usleep  to  handle  longer
45       sleep durations than sleep.
46

BUGS

48       On  the  PDP-11  the  clock resolution is limited to the line frequency
49       (usually 60Hz in the U.S.A. and 50Hz elsewhere).
50

HISTORY

52       A usleep function appeared in 4.3BSD.  A sleep function appeared in V7.
53
54
55
563rd Berkeley Distribution      September 26,1997                      SLEEP(3)
Impressum