Patch: platform usleep function

Jeff Sturm jsturm@one-point.com
Thu Dec 19 15:23:00 GMT 2002


On 19 Dec 2002, Tom Tromey wrote:
> +inline void
> +_Jv_platform_usleep (unsigned long usecs)
> +{
> +  usleep (usecs);
> +}
> +

Is there any reason to prefer usleep over nanosleep?  The latter is POSIX
compatible and doesn't require signals.  Also, usleep is unusable on some
other platforms, including Solaris.

Whatever is used would preferably sleep and not spin.  I tested nanosleep
on x86-linux; it sleeps for durations as short as 20ms.  On
sparc-solaris2.8 it is usable down to 10ms.

Jeff



More information about the Java-patches mailing list