2 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
4 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
6 .\" References consulted:
7 .\" Linux libc source code
8 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
10 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
11 .\" Modified 2001-04-01 by aeb
12 .\" Modified 2003-07-23 by aeb
14 .TH usleep 3 (date) "Linux man-pages (unreleased)"
16 usleep \- suspend execution for microsecond intervals
19 .RI ( libc ", " \-lc )
22 .B "#include <unistd.h>"
24 .BI "int usleep(useconds_t " usec );
28 Feature Test Macro Requirements for glibc (see
29 .BR feature_test_macros (7)):
35 (_XOPEN_SOURCE >= 500) && ! (_POSIX_C_SOURCE >= 200809L)
36 || /* glibc >= 2.19: */ _DEFAULT_SOURCE
37 || /* glibc <= 2.19: */ _BSD_SOURCE
39 _BSD_SOURCE || _XOPEN_SOURCE >= 500
40 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
45 function suspends execution of the calling thread for
46 (at least) \fIusec\fP microseconds.
47 The sleep may be lengthened slightly
48 by any system activity or by the time spent processing the call or by the
49 granularity of system timers.
53 function returns 0 on success.
54 On error, \-1 is returned, with
56 set to indicate the error.
60 Interrupted by a signal; see
64 \fIusec\fP is greater than or equal to 1000000.
65 (On systems where that is considered an error.)
67 For an explanation of the terms used in this section, see
73 Interface Attribute Value
78 T} Thread safety MT-Safe
84 POSIX.1-2001 declares it obsolete, suggesting
87 Removed in POSIX.1-2008.
89 On the original BSD implementation,
90 and before glibc 2.2.2, the return type of this function is
92 The POSIX version returns
94 and this is also the prototype used since glibc 2.2.2.
98 error return is documented by SUSv2 and POSIX.1-2001.
100 The interaction of this function with the
102 signal, and with other timer functions such as
107 .BR timer_create (2),
108 .BR timer_delete (2),
109 .BR timer_getoverrun (2),
110 .BR timer_gettime (2),
111 .BR timer_settime (2),
122 .BR useconds_t (3type),