Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!mailrus!ncar!mephisto!gatech!Galois!lef From: lef@dogwood.atl.ga.us (Lawrence E. Freil) Newsgroups: comp.unix.internals Subject: Re: Can Unix sleep in terms of mili/micro? Message-ID: <1990Sep21.141532.4005@dogwood.atl.ga.us> Date: 21 Sep 90 14:15:32 GMT References: <24437@adm.BRL.MIL> <84@dlss2.UUCP> <1990Sep12.231326.19897@virtech.uucp> Organization: National Science Center Foundation Lines: 36 For System V.3 or greater why not use the following code: /************************************************************************** * Function Name : nap * Argument Description : time to sleep in milliseconds * Global References : (a % by the name indicates an alteration occurs) * Author : Lawrence Freil * Function Description : * This routine uses the poll system call to delay a specified number * of milliseconds. Poll called without any file descriptors but with * a timeout specified works for this purpose. * **************************************************************************/ int nap(int timeout) { struct pollfd foo[1]; int status; status = poll(foo, 0L, timeout); return status; } You can also do the same thing for berkley with the select call (no files, just the timeout.) Lawrence Freil Usenet/DDN:lef@dogwood.atl.ga.us National Science Center Foundation Phone:(404)-828-8459 P.O. Box 1648 Augusta, Ga 30903 -- Lawrence Freil Usenet/DDN:lef@dogwood.atl.ga.us National Science Center Foundation Phone:(404)-828-8459 P.O. Box 1648 Augusta, Ga 30903