comp.unix.questions comp.unix.misc comp.unix.sys5.r3

comp.unix.questions comp.unix.misc comp.unix.sys5.r3

Post by Jeff Dicks » Sat, 14 Jan 1995 03:43:56

>: Could you tell me how to sleep for 100 milliseconds
>: without staying in a loop. The normal sleep() function
>: will suspend the process for minimum of 1 sec.

>I saw a function called setitimer() on several systems. This functions allows
>you to set the resolution for calls like sleep().


Uh, I don't think so. But, the timers useable by setitimer() can be set for
100 millisecond intervals. Plus, a signal is generated when the particular
timer (you have 3 to choose from) expires. Instead of looping you could just
wait for the signal to occur. If no other signals are being delivered the
wait() call could be easily used for this purpose. Otherwise you'll want to
use the sigpause() call to only wake up when a certain signal is delivered.
Keep in mind that the actual time required to notify a process of a timer
expiring is dependant on the system load.

Jeff S.*son