sleep()ing less than a second

Wm E Davidsen Jr davidsen at crdos1.crd.ge.COM
Wed Dec 20 06:34:26 AEST 1989


In article <2754 at servax0.essex.ac.uk> peter at essex.ac.uk (Allott P) writes:

| It is possible to "sleep" for less than one second by doing a
| selcect(.......) with an appropriate value in the timeval (5th param I think)
| and with no channels to check (2nd through 4th params I think).
| See the documentation for full details.

  Correct. There are also vendor dependent routines in other versions.
Common names are mspeel (in ms), usleep (in us, but clock tick
resolution), and nap (ms again).

  nap is xenix and 5.3.2 and later, uspeep is SunOS and some others,
don't know where msleep is from, got some source with
	msleep(50); /* wait 50 ms */
in it, so I know it's out there somewhere. nap and select are your best
bets for portability. I *think* there's a version of nap for BSD, but I
don't have it here.
-- 
bill davidsen	(davidsen at crdos1.crd.GE.COM -or- uunet!crdgw1!crdos1!davidsen)
"The world is filled with fools. They blindly follow their so-called
'reason' in the face of the church and common sense. Any fool can see
that the world is flat!" - anon



More information about the Comp.lang.c mailing list