Re: nanosleep

andrew may (acmay@acmay.homeip.net)
Sat, 13 Apr 2002 14:53:06 -0700


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.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/