Re: nanosleep

andrew may
2002-04-13T21:53:09Z

On Wed, Apr 10, 2002 at 02:01:35AM -0400, Robert Love wrote:
> On Wed, 2002-04-10 at 01:57, mark manning wrote:
> > hrm - im confiused now - how can you do a n NANO second delay when the
> > resolution is 10 mili seconds ?
>
> Uh, you can't - that was his point.

Well there is a cheap trick if you catch what the man page says.

> You can try, and you will certainly sleep at least that long, but any
> time given modulo 10ms is out the door ...

Make all your calls to nanasleep be less than 2ms, and loop through as
many as you need until you are under 2ms.

Don't do it for too long because you get no other use out of your machine
while your doing this but it does work.