[comp.unix.ultrix] how do I usleep

asleeman@waikato.ac.nz (03/05/90)

Gidday,

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?

Thanks
Andrew Sleeman

michaud@decvax.dec.com (Jeff Michaud) (03/06/90)

> 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 <standard/disclaimer.h>              |
\--------------------------------------------------------------/

dent@unocss..unl.edu (Local Submission) (03/07/90)

You might also be able to use napms(), but it's expecting milliseconds instead
of nanoseconds.  (Thought that might be small enough depending on how many
nanoseconds you want! :-)


-/ Dave Caplinger /---------------------------------------------------------
 Microcomputer Specialist,   Campus Computing,   Univ. of Nebraska at Omaha
 dent@zeus.unomaha.edu         ...!uunet!unocss!dent            DENT@UNOMA1