1SLEEP(3)                   Linux Programmer's Manual                  SLEEP(3)
2
3
4

NAME

6       sleep - sleep for a specified number of seconds
7

SYNOPSIS

9       #include <unistd.h>
10
11       unsigned int sleep(unsigned int seconds);
12

DESCRIPTION

14       sleep()  causes  the calling thread to sleep either until the number of
15       real-time seconds specified in seconds have elapsed or until  a  signal
16       arrives which is not ignored.
17

RETURN VALUE

19       Zero  if  the requested time has elapsed, or the number of seconds left
20       to sleep, if the call was interrupted by a signal handler.
21

ATTRIBUTES

23       For  an  explanation  of  the  terms  used   in   this   section,   see
24       attributes(7).
25
26       ┌──────────┬───────────────┬─────────────────────────────┐
27Interface Attribute     Value                       
28       ├──────────┼───────────────┼─────────────────────────────┤
29sleep()   │ Thread safety │ MT-Unsafe sig:SIGCHLD/linux │
30       └──────────┴───────────────┴─────────────────────────────┘
31

CONFORMING TO

33       POSIX.1-2001, POSIX.1-2008.
34

NOTES

36       On   Linux,   sleep()   is   implemented  via  nanosleep(2).   See  the
37       nanosleep(2) man page for a discussion of the clock used.
38
39   Portability notes
40       On some systems, sleep() may be implemented using alarm(2) and  SIGALRM
41       (POSIX.1  permits  this); mixing calls to alarm(2) and sleep() is a bad
42       idea.
43
44       Using longjmp(3) from a signal handler or  modifying  the  handling  of
45       SIGALRM while sleeping will cause undefined results.
46

SEE ALSO

48       sleep(1), alarm(2), nanosleep(2), signal(2), signal(7)
49

COLOPHON

51       This  page  is  part of release 5.04 of the Linux man-pages project.  A
52       description of the project, information about reporting bugs,  and  the
53       latest     version     of     this    page,    can    be    found    at
54       https://www.kernel.org/doc/man-pages/.
55
56
57
58GNU                               2017-09-15                          SLEEP(3)
Impressum