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

NAME

6       usleep - suspend execution for microsecond intervals
7

SYNOPSIS

9       #include <unistd.h>
10
11       int usleep(useconds_t usec);
12
13   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
14
15       usleep(): _BSD_SOURCE || _XOPEN_SOURCE >= 500
16

DESCRIPTION

18       The usleep() function suspends execution of the calling process for (at
19       least) usec microseconds.  The sleep may be lengthened slightly by  any
20       system  activity  or  by  the  time spent processing the call or by the
21       granularity of system timers.
22

RETURN VALUE

24       0 on success, -1 on error.
25

ERRORS

27       EINTR  Interrupted by a signal; see signal(7).
28
29       EINVAL usec is not smaller than 1000000.  (On  systems  where  that  is
30              considered an error.)
31

CONFORMING TO

33       4.3BSD,  POSIX.1-2001.   POSIX.1-2001  declares this function obsolete;
34       use nanosleep(2) instead.  POSIX.1-2008 removes  the  specification  of
35       usleep().
36
37       On  the original BSD implementation, and in glibc before version 2.2.2,
38       the return type of this function is void.  The  POSIX  version  returns
39       int, and this is also the prototype used since glibc 2.2.2.
40
41       Only the EINVAL error return is documented by SUSv2 and POSIX.1-2001.
42

NOTES

44       The  type  useconds_t  is  an  unsigned integer type capable of holding
45       integers in the range [0,1000000].  Programs will be more  portable  if
46       they never mention this type explicitly.  Use
47
48           #include <unistd.h>
49           ...
50               unsigned int usecs;
51           ...
52               usleep(usecs);
53
54       The  interaction  of  this  function  with the SIGALRM signal, and with
55       other  timer  functions  such  as  alarm(2),  sleep(3),   nanosleep(2),
56       setitimer(2),  timer_create(2),  timer_delete(2),  timer_getoverrun(2),
57       timer_gettime(2), timer_settime(2), ualarm(3) is unspecified.
58

SEE ALSO

60       alarm(2),   getitimer(2),   nanosleep(2),   select(2),    setitimer(2),
61       sleep(3), ualarm(3), time(7)
62

COLOPHON

64       This  page  is  part of release 3.25 of the Linux man-pages project.  A
65       description of the project, and information about reporting  bugs,  can
66       be found at http://www.kernel.org/doc/man-pages/.
67
68
69
70                                  2007-07-26                         USLEEP(3)
Impressum