This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: spin() and Win32 port


Tom Tromey wrote:
I let in a small change to natObject.cc that changed spin() to call
Thread::sleep instead of usleep().

I think this was a mistake (to be honest I don't recall seeing that
code in a patch, double oops on me).  spin() is used in the
It was let in via this patch:

http://gcc.gnu.org/ml/java-patches/2002-q4/msg00073.html

BTW, notice that Thread::sleep takes nanoseconds in the
second parameter, but is being passed a microseconds
value...

I could find only millisecond granularity for Win32
timers - the Win32 Sleep( ) function takes the number
of milliseconds to sleep. The usleep( ) function takes
the number of microseconds to sleep and is not defined
at all in MSVCRT (and therefore MinGW).

The SetWaitableTimer Win32 function does provide a
100-nanosecond granularity, but would not work on Win95. :-(

If waiting for a millisecond or more is OK (note:
MAX_SLEEP_USECS is 200000 us = 200 ms, MIN_SLEEP_USECS
is 2001 us = 2 ms), I guess we can use the Win32 Sleep
function.

Ranjit.

--
Ranjit Mathew          Email: rmathew AT hotmail DOT com

Bangalore, INDIA.      Web: http://ranjitmathew.tripod.com/




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]