This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: criticalsections are very fast / pooling mutexes / how does hash-sync work?
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Adam Megacz <gcj at lists dot megacz dot com>
- Cc: "'java at gcc dot gnu dot org '" <java at gcc dot gnu dot org>
- Date: Mon, 24 Dec 2001 11:49:24 -0500 (EST)
- Subject: Re: criticalsections are very fast / pooling mutexes / how does hash-sync work?
On 23 Dec 2001, Adam Megacz wrote:
> Hrm, shouldn't the one that's there for Linux-x86 work? It's just
> straight asm, no system calls...
Look at how JV_HASH_SYNCHRONIZATION and SLOW_PTHREAD_SELF are defined in
posix-threads.h. The latter is a fallback for targets that don't keep
a fast thread pointer. (For Win32 you can consider using TLS, e.g.
TlsGetValue(_Jv_ThreadKey). I don't know how TLS is implemented on
Windows nor what it costs.) You'll need to port these definitions to
win32-threads.h.
Also look at the spin() function in natObject.cc. This has some
assumptions that are only true of Linux, i.e. minimum usable sleep
duration. (I'd prefer this function move to the threads interface... it
isn't suitable for Win32 as-is, nor Solaris for that matter.)
Jeff