USLEEP(3) Library Functions Manual USLEEP(3)NAME
usleep - suspend execution for interval
The current process is suspended from execution for the number of microseconds specified by the argument. The actual suspension time may
be an arbitrary amount longer because of other activity in the system or because of the time spent in processing the call.
The routine is implemented by setting an interval timer and pausing until it occurs. The previous state of this timer is saved and
restored. If the sleep time exceeds the time to the expiration of the previous timer, the process sleeps only until the signal would have
occurred, and the signal is sent a short time later.
This routine is implemented using setitimer(2); it requires eight system calls each time it is invoked. A similar but less compatible
function can be obtained with a single select(2); it would not restart after signals, but would not interfere with other uses of setitimer.
SEE ALSO setitimer(2), getitimer(2), sigpause(2), ualarm(3), sleep(3), alarm(3)NOTES (PDP-11)
On the PDP-11, setitimer(2) rounds the number of microseconds up to seconds resolution, therefore usleep doesn't give you any more resolu-
tion than sleep(3). Select(2) offers clock resolution (usually 60Hz in the U.S.A. and 50Hz elsewhere) and so should be used instead.
4.3 Berkeley Distribution August 26, 1988 USLEEP(3)
Check Out this Related Man Page
USLEEP(3) Linux Programmer's Manual USLEEP(3)NAME
usleep - suspend execution for microsecond intervals
void usleep(unsigned long usec);
int usleep(unsigned long usec); /* SUSv2 */
The usleep() function suspends execution of the calling process for usec microseconds. The sleep may be lengthened slightly by any system
activity or by the time spent processing the call.
None (BSD). Or: 0 on success, -1 on error (SUSv2).
EINTR Interrupted by a signal.
EINVAL usec is not smaller than 1000000. (On systems where that is considered an error.)
BSD 4.3. The SUSv2 version returns int, and this is also the prototype used by glibc 2.2.2. Only the EINVAL error return is documented by
The interaction of this function with SIGALRM and other timer functions such as sleep(), alarm(), setitimer(), nanosleep() is unspecified.
This function is obsolete. Use nanosleep(2) or setitimer(2) instead.
SEE ALSO alarm(2), getitimer(2), nanosleep(2), select(2), setitimer(2), sleep(3)
I set a timer using setitimer to expire every 30 ms.
Usually it does. But sometimes it takes ~ 700 ms between 2 successive arousals (expirations). The timing is crucial for me.
The process with the timer is almost the only one running on the computer.
How do I overcome this problem? (1 Reply)
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)
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)
In the process of restoring a few DEC PDP-11/34's (34a, and 34). Curious what BSD versions will run on the 34 (if any).
It looks like 1BSD or 2BSD might run on it, but not sure. Curious if anyone knows, or has done this. (1 Reply)
I have 2 files that print on the same line at the same time. I wanted to add time.sleep() to 1 of the textfiles. I wanted to delay the time that 1 textfile prints with the other 1 in this script. I wanted to have the files to create new lines instead of printing the same combinations when they both... (5 Replies)