usleep(3C)usleep(3C)NAME
usleep - suspend execution for interval in microseconds
SYNOPSIS
#include <unistd.h>
int usleep(useconds_t useconds);
The usleep() function suspends the caller from execution for the number of microseconds specified by the useconds argument. The actual sus-
pension 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 sys-
tem.
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.
On completion, usleep() returns 0. There are no error retruns.
No errors are returned.
USAGE
The usleep() function is included for its historical usage. The nanosleep(3RT) function is preferred over this function.
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Standard |
+-----------------------------+-----------------------------+
|MT-Level |Safe |
+-----------------------------+-----------------------------+
nanosleep(3RT), sleep(3C), attributes(5), standards(5)
16 Mar 2005 usleep(3C)
Check Out this Related Man Page
USLEEP(3) BSD Library Functions Manual USLEEP(3)NAME
usleep -- suspend thread execution for an interval measured in microseconds
LIBRARY
Standard C Library (libc, -lc)
SYNOPSIS
#include <unistd.h>
int
usleep(useconds_t useconds);
DESCRIPTION
The usleep() function suspends execution of the calling thread until either useconds microseconds have elapsed or a signal is delivered to
the thread whose action is to invoke a signal-catching function or to terminate the thread or process. The actual time slept may be longer,
due to system latencies and possible limitations in the timer resolution of the hardware.
This function is implemented, using nanosleep(2), by pausing for useconds microseconds or until a signal occurs. Consequently, in this
implementation, sleeping has no effect on the state of process timers and there is no special handling for SIGALRM.
RETURN VALUES
The usleep() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate
the error.
ERRORS
The usleep() function will fail if:
[EINTR] A signal was delivered to the process and its action was to invoke a signal-catching function.
SEE ALSO nanosleep(2), sleep(3)HISTORY
The usleep() function appeared in 4.3BSD.
BSD February 13, 1998 BSD
Hi,
I'm using the command usleep (500000) when compiling C++ on the SunOS platform, but it does not compile on a OSF1 platform?
Any ideas?
Thanks (5 Replies)
Hi all,
do ny o u'll know how to set a particular execution time for a program???
for eg.:
--> during the execution of a file, i call a certain other function.
--> while calling this function, my comp hangs.
now is there ny way in which i can go to the nxt line of code by aborting the call... (7 Replies)
Hi All,
I need usleep command to use in one of my shell script. I am working on SunOS 5.9. Where usleep command is not available. Is there any way to use usleep command in SunOS.
Thanks In Advance,
chidhu (5 Replies)
Hi ,
How can I use floating point argument for sleep command in unix.I cannot use usleep as it is not suppported.
Also how can I find out that a file is in use at that particular instant only.(wether it is being read or written) (7 Replies)