Andrew Haley wrote: > Why? If you're going to call pthread_getspecific() to get the current > thread, you might as well call it to get the thread-local variable. > That remains true regardless of GC, TL inheritance, or anything else.
PTHREAD_KEYS_MAX is very low on some OSes compared with the needs of some Java apps. Non-conservative GC means that an extra indirection layer is needed, you might as well add another one and hang everything off the Thread object. > > Not to mention the VMs that already have Thread.currentThread() > > specific optimizations. > > Sure, but they might as well optimize ThreadLocals while they're at it. Maybe, but for IKVM that wouldn't have been an option due to the peculiarities of the underlying platform (note that IKVM doesn't support GNU Classpath anymore, so it's just an example, I don't care either way.), but optimizing a thread local static was easy. Regards, Jeroen