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
UALARM(3) Library Functions Manual UALARM(3)NAME
ualarm - schedule signal after specified time
unsigned ualarm(value, interval)
This is a simplified interface to setitimer(2).
Ualarm causes signal SIGALRM, see signal(3C), to be sent to the invoking process in a number of microseconds given by the value argument.
Unless caught or ignored, the signal terminates the process.
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 value microseconds have passed).
Because of scheduling delays, resumption of execution of when the signal is caught may be delayed an arbitrary amount. The longest speci-
fiable delay time (on the vax) is 2147483647 microseconds.
The return value is the amount of time previously remaining in the alarm clock.
SEE ALSO getitimer(2), setitimer(2), sigpause(2), sigvec(2), signal(3C), sleep(3), alarm(3), usleep(3)NOTES (PDP-11)
On the PDP-11, setitimer(2) rounds the number of microseconds up to seconds resolution, therefore ualarm doesn't give you any more resolu-
tion than alarm(3).
4.3 Berkeley Distribution August 26, 1988 UALARM(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)