1 .\" Copyright 1993 David Metcalfe (david@prism.demon.co.uk)
3 .\" SPDX-License-Identifier: Linux-man-pages-copyleft
5 .\" References consulted:
6 .\" Linux libc source code
7 .\" Lewine's _POSIX Programmer's Guide_ (O'Reilly & Associates, 1991)
9 .\" Modified 1993-07-24 by Rik Faith (faith@cs.unc.edu)
10 .\" Modified 2001-04-01 by aeb
11 .\" Modified 2003-07-23 by aeb
13 .TH usleep 3 (date) "Linux man-pages (unreleased)"
15 usleep \- suspend execution for microsecond intervals
18 .RI ( libc ", " \-lc )
21 .B "#include <unistd.h>"
23 .BI "int usleep(useconds_t " usec );
27 Feature Test Macro Requirements for glibc (see
28 .BR feature_test_macros (7)):
34 (_XOPEN_SOURCE >= 500) && ! (_POSIX_C_SOURCE >= 200809L)
35 || /* Glibc since 2.19: */ _DEFAULT_SOURCE
36 || /* Glibc <= 2.19: */ _BSD_SOURCE
38 _BSD_SOURCE || _XOPEN_SOURCE >= 500
39 .\" || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
44 function suspends execution of the calling thread for
45 (at least) \fIusec\fP microseconds.
46 The sleep may be lengthened slightly
47 by any system activity or by the time spent processing the call or by the
48 granularity of system timers.
52 function returns 0 on success.
53 On error, \-1 is returned, with
55 set to indicate the error.
59 Interrupted by a signal; see
63 \fIusec\fP is greater than or equal to 1000000.
64 (On systems where that is considered an error.)
66 For an explanation of the terms used in this section, see
74 Interface Attribute Value
77 T} Thread safety MT-Safe
84 POSIX.1-2001 declares this function obsolete; use
87 POSIX.1-2008 removes the specification of
90 On the original BSD implementation,
91 and in glibc before version 2.2.2, the return type of this function is
93 The POSIX version returns
95 and this is also the prototype used since glibc 2.2.2.
99 error return is documented by SUSv2 and POSIX.1-2001.
101 The interaction of this function with the
103 signal, and with other timer functions such as
108 .BR timer_create (2),
109 .BR timer_delete (2),
110 .BR timer_getoverrun (2),
111 .BR timer_gettime (2),
112 .BR timer_settime (2),
123 .BR useconds_t (3type),