Path: utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!apple!oliveb!orc!decwrl!shlump.nac.dec.com!michaud From: michaud@decvax.dec.com (Jeff Michaud) Newsgroups: comp.unix.ultrix Subject: Re: how do I usleep() [micro-seconds sleep] ??? Message-ID: <8928@shlump.nac.dec.com> Date: 5 Mar 90 22:25:49 GMT References: <206.25f2a9ce@waikato.ac.nz> Sender: news@shlump.nac.dec.com Organization: DEC Lines: 17 > Is there a, or is it possible to create a, sleep routine under ULTRIX that > will sleep for a number of micro-seconds instead of seconds? Any ideas? I had posted a code fragment last year that implemented usleep() using select(2) with a timeout (and passing in nil pointers for all the select masks). I don't seem to of kept a copy of what I posted. See the select(2) man page however, it's pretty simple. Just make sure that the usec time in the timeval struture isn't greater than 1 second (ie. use integer / and % to fill in both the seconds and usec field). have fun! /--------------------------------------------------------------\ |Jeff Michaud michaud@decwrl.dec.com michaud@decvax.dec.com| |DECnet-ULTRIX #include | \--------------------------------------------------------------/