talk session

Perry E. Metzger metzger at watson.ibm.com
Thu May 9 05:49:40 AEST 1991


In article <1991May7.102219.25557 at ssd.kodak.com> weimer at ssd.kodak.com writes:
>In article <1991May7.084631.10183 at prl.dec.com>, boyd at prl.dec.com (Boyd
>Roberts) writes:
>|> In article <1991May7.000521.28186 at athena.cs.uga.edu>,
>greg at athena.cs.uga.edu (Greg Whitlock) writes:
>|> > 		for (i = 0; i < delay; i++)
>|> > 			;
>|> You cannot be serious.  I think your `friend' should man sleep(3).
>
>Mmmm, my man page doesn't tell me how to sleep for less than 1 second...

Check out usleep, or, if you don't have it and are on a BSD system,
write your own using select with a timeout and no file descriptors. Or
use the getitimer/setitimer facility if somehow you don't have the
rest but you have them. All these let you nap for less than a second.

Really, there is ABSOLUTELY NO EXCUSE for busy waiting on a
timesharing system. Its obnoxious because it wastes the cycles other
people could be getting work done during.

Perry



More information about the Comp.unix.questions mailing list