xref: /illumos-gate/usr/src/man/man3c/usleep.3c (revision 31c6d826a7f7a4ee7d83c8e99f25d82a4a248076)
te
Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
Copyright (c) 1980 Regents of the University of California. All rights reserved. The Berkeley software License Agreement specifies the terms and conditions for redistribution.
Portions Copyright (c) 1992, X/Open Company Limited All Rights Reserved.
Sun Microsystems, Inc. gratefully acknowledges The Open Group for permission to reproduce portions of its copyrighted documentation. Original documentation from The Open Group can be obtained online at
http://www.opengroup.org/bookstore/.
The Institute of Electrical and Electronics Engineers and The Open Group, have given us permission to reprint portions of their documentation. In the following statement, the phrase "this text" refers to portions of the system documentation. Portions of this text are reprinted and reproduced in electronic form in the Sun OS Reference Manual, from IEEE Std 1003.1, 2004 Edition, Standard for Information Technology -- Portable Operating System Interface (POSIX), The Open Group Base Specifications Issue 6, Copyright (C) 2001-2004 by the Institute of Electrical and Electronics Engineers, Inc and The Open Group. In the event of any discrepancy between these versions and the original IEEE and The Open Group Standard, the original IEEE and The Open Group Standard is the referee document. The original Standard can be obtained online at http://www.opengroup.org/unix/online.html.
This notice shall appear on any product containing this material.
USLEEP 3C "Feb 5, 2008"
NAME
usleep - suspend execution for interval in microseconds
SYNOPSIS

#include <unistd.h>

int usleep(useconds_t useconds);
DESCRIPTION

The usleep() function suspends the caller from execution for the number of microseconds specified by the useconds argument. The actual suspension time might be less than requested because any caught signal will terminate usleep() following execution of that signal's catching routine. The suspension time might be longer than requested by an arbitrary amount because of the scheduling of other activity in the system.

If the value of useconds is 0, then the call has no effect.

The use of the usleep() function has no effect on the action or blockage of any signal. In a multithreaded process, only the invoking thread is suspended from execution.

RETURN VALUES

On completion, usleep() returns 0. There are no error returns.

ERRORS

No errors are returned.

USAGE

The usleep() function is included for its historical usage. The nanosleep(3C) function is preferred over this function.

ATTRIBUTES

See attributes(5) for descriptions of the following attributes:

ATTRIBUTE TYPE ATTRIBUTE VALUE
Interface Stability Committed
MT-Level Safe
Standard See standards(5).
SEE ALSO

nanosleep(3C), sleep(3C), attributes(5), standards(5)