Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

usleep(3) [bsd man page]

USLEEP(3)						     Library Functions Manual							 USLEEP(3)

NAME
usleep - suspend execution for interval SYNOPSIS
usleep(useconds) unsigned useconds; DESCRIPTION
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

UALARM(3)						   BSD Library Functions Manual 						 UALARM(3)

NAME
ualarm -- schedule signal after specified time LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> useconds_t ualarm(useconds_t useconds, useconds_t interval); DESCRIPTION
This is a simplified interface to setitimer(2). The ualarm() function waits a count of useconds before asserting the terminating signal SIGALRM. System activity or time used in processing the call may cause a slight delay. If the interval argument is non-zero, the SIGALRM signal will be sent to the process every interval microseconds after the timer expires (e.g., after useconds number of microseconds have passed). Due to a setitimer(2) restriction, the maximum number of useconds and interval is limited to 100,000,000,000,000 (in case this value fits in the unsigned integer). RETURN VALUES
When the signal has successfully been caught, ualarm() returns the amount of time left on the clock. NOTES
A microsecond is 0.000001 seconds. SEE ALSO
getitimer(2), setitimer(2), sigpause(2), sigvec(2), alarm(3), signal(3), sleep(3), usleep(3) HISTORY
The ualarm() function appeared in 4.3BSD. BSD
April 19, 1994 BSD
Man Page

6 More Discussions You Might Find Interesting

1. AIX

how to implement timer

anyone can help me how to implement the timer on AIX? I tried with 'setitimer' and its related functions, but it does not work correctly,the program exited each time. thanks (2 Replies)
Discussion started by: Frank2004
2 Replies

2. Programming

setitimer expires in wrong time

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)
Discussion started by: inna
1 Replies

3. Solaris

usleep command is not available in SunOS

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)
Discussion started by: pa.chidhambaram
5 Replies

4. UNIX for Advanced & Expert Users

Floating point argument for sleep command in Unix

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)
Discussion started by: kanus
7 Replies

5. BSD

BSD for PDP-11/34a?

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)
Discussion started by: xenix
1 Replies

6. UNIX for Beginners Questions & Answers

Adder timer to 1 of these columns

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)
Discussion started by: bigvito19
5 Replies