]>
Commit | Line | Data |
---|---|---|
bf5a7247 | 1 | .\" Copyright (c) 1993 by Thomas Koenig (ig25@rz.uni-karlsruhe.de) |
fea681da | 2 | .\" |
93015253 | 3 | .\" %%%LICENSE_START(VERBATIM) |
fea681da MK |
4 | .\" Permission is granted to make and distribute verbatim copies of this |
5 | .\" manual provided the copyright notice and this permission notice are | |
6 | .\" preserved on all copies. | |
7 | .\" | |
8 | .\" Permission is granted to copy and distribute modified versions of this | |
9 | .\" manual under the conditions for verbatim copying, provided that the | |
10 | .\" entire resulting derived work is distributed under the terms of a | |
11 | .\" permission notice identical to this one. | |
c13182ef | 12 | .\" |
fea681da MK |
13 | .\" Since the Linux kernel and libraries are constantly changing, this |
14 | .\" manual page may be incorrect or out-of-date. The author(s) assume no | |
15 | .\" responsibility for errors or omissions, or for damages resulting from | |
16 | .\" the use of the information contained herein. The author(s) may not | |
17 | .\" have taken the same level of care in the production of this manual, | |
18 | .\" which is licensed free of charge, as they might when working | |
19 | .\" professionally. | |
c13182ef | 20 | .\" |
fea681da MK |
21 | .\" Formatted or processed versions of this manual, if unaccompanied by |
22 | .\" the source, must acknowledge the copyright and authors of this work. | |
4b72fb64 | 23 | .\" %%%LICENSE_END |
c08df37a | 24 | .\" |
fea681da | 25 | .\" Modified Sat Jul 24 18:16:02 1993 by Rik Faith (faith@cs.unc.edu) |
4b8c67d9 | 26 | .TH SLEEP 3 2017-09-15 "GNU" "Linux Programmer's Manual" |
fea681da | 27 | .SH NAME |
1f6cc4a6 | 28 | sleep \- sleep for a specified number of seconds |
fea681da MK |
29 | .SH SYNOPSIS |
30 | .nf | |
31 | .B #include <unistd.h> | |
68e4db0a | 32 | .PP |
fea681da MK |
33 | .BI "unsigned int sleep(unsigned int " "seconds" ); |
34 | .fi | |
35 | .SH DESCRIPTION | |
63aa9df0 | 36 | .BR sleep () |
5288e1f5 | 37 | causes the calling thread to sleep either until |
5272b4c4 | 38 | the number of real-time seconds specified in |
fea681da | 39 | .I seconds |
5288e1f5 | 40 | have elapsed or until a signal arrives which is not ignored. |
47297adb | 41 | .SH RETURN VALUE |
cfd4a9a6 MK |
42 | Zero if the requested time has elapsed, |
43 | or the number of seconds left to sleep, | |
44 | if the call was interrupted by a signal handler. | |
7e548ead ZL |
45 | .SH ATTRIBUTES |
46 | For an explanation of the terms used in this section, see | |
47 | .BR attributes (7). | |
48 | .TS | |
49 | allbox; | |
50 | lb lb lbw27 | |
51 | l l l. | |
52 | Interface Attribute Value | |
53 | T{ | |
54 | .BR sleep () | |
55 | T} Thread safety MT-Unsafe sig:SIGCHLD/linux | |
56 | .TE | |
847e0d88 | 57 | .sp 1 |
47297adb | 58 | .SH CONFORMING TO |
a6db971b | 59 | POSIX.1-2001, POSIX.1-2008. |
0d28787b | 60 | .SH NOTES |
330e8847 MK |
61 | On Linux, |
62 | .BR sleep () | |
63 | is implemented via | |
64 | .BR nanosleep (2). | |
65 | See the | |
66 | .BR nanosleep (2) | |
67 | man page for a discussion of the clock used. | |
0d28787b MK |
68 | .SS Portability notes |
69 | On some systems, | |
63aa9df0 | 70 | .BR sleep () |
fea681da | 71 | may be implemented using |
0d28787b MK |
72 | .BR alarm (2) |
73 | and | |
74 | .BR SIGALRM | |
75 | (POSIX.1 permits this); | |
fea681da | 76 | mixing calls to |
bfbfd71d | 77 | .BR alarm (2) |
fea681da | 78 | and |
63aa9df0 | 79 | .BR sleep () |
fea681da MK |
80 | is a bad idea. |
81 | .PP | |
82 | Using | |
fb186734 | 83 | .BR longjmp (3) |
c13182ef | 84 | from a signal handler or modifying the handling of |
fea681da MK |
85 | .B SIGALRM |
86 | while sleeping will cause undefined results. | |
47297adb | 87 | .SH SEE ALSO |
9bfa6a84 | 88 | .BR sleep (1), |
fea681da | 89 | .BR alarm (2), |
87209bbe | 90 | .BR nanosleep (2), |
cfd4a9a6 MK |
91 | .BR signal (2), |
92 | .BR signal (7) |