MirBSD manpage: usleep(3)

USLEEP(3)                  BSD Programmer's Manual                   USLEEP(3)


     usleep - suspend execution for interval of microseconds


     #include <unistd.h>

     usleep(useconds_t microseconds);


     The usleep() function suspends execution of the calling process for
     microseconds microseconds of time. System activity or time spent in pro-
     cessing the call may lengthen the sleep slightly.

     This routine is implemented using nanosleep(2); it requires one system
     call each time it is invoked. A similar but less compatible function can
     be obtained with a single select(2); such a function would not restart
     after signals, and also does not interfere with other uses of
     setitimer(2) (not that usleep() interferes with interval timers anymore).


     If the usleep() function returns because the requested time has elapsed,
     the value returned will be zero.

     If the usleep() function returns due to the delivery of a signal, the
     value returned will be -1, and the global variable errno will be set to
     indicate the interruption.


     If any of the following conditions occur, the usleep() function shall re-
     turn -1 and set errno to the corresponding value.

     [EINTR]       usleep() was interrupted by the delivery of a signal.

     [EINVAL]      microseconds specified a value of 1,000,000 or more mi-


     A microsecond is 0.000001 seconds.


     getitimer(2), nanosleep(2), setitimer(2), alarm(3), sigpause(3),
     sleep(3), ualarm(3)


     The usleep() function conforms to X/Open Portability Guide Issue 4,
     Version 2 ("XPG4.2").


     The usleep() function appeared in 4.3BSD.

MirBSD #10-current             November 4, 1997                              1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung