Section: Linux Programmer's Manual (3)
Return to Main Contents
usleep - suspend execution for microsecond intervals
int usleep(useconds_t usec);
Feature Test Macro Requirements for glibc (see
- Since glibc 2.12:
(_XOPEN_SOURCE >= 500 ||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED) &&
!(_POSIX_C_SOURCE >= 200809L || _XOPEN_SOURCE >= 700)
Before glibc 2.12:
_BSD_SOURCE || _XOPEN_SOURCE >= 500 ||
_XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED
function suspends execution of the calling thread for
(at least) usec microseconds.
The sleep may be lengthened slightly
by any system activity or by the time spent processing the call or by the
granularity of system timers.
function returns 0 on success.
On error, -1 is returned, with
set to indicate the cause of the error.
Interrupted by a signal; see
usec is not smaller than 1000000.
(On systems where that is considered an error.)
POSIX.1-2001 declares this function obsolete; use
POSIX.1-2008 removes the specification of
On the original BSD implementation,
and in glibc before version 2.2.2, the return type of this function is
The POSIX version returns
and this is also the prototype used since glibc 2.2.2.
error return is documented by SUSv2 and POSIX.1-2001.
is an unsigned integer type capable of holding integers
in the range [0,1000000].
Programs will be more portable
if they never mention this type explicitly.
unsigned int usecs;
The interaction of this function with the
signal, and with other timer functions such as
This page is part of release 3.54 of the Linux
A description of the project,
and information about reporting bugs,
can be found at
- RETURN VALUE
- CONFORMING TO
- SEE ALSO
This document was created by
using the manual pages.
Time: 01:58:23 GMT, January 23, 2018