RFR: 8219613: Use NonJavaThread PtrQueues

Kim Barrett kim.barrett at oracle.com
Tue Feb 26 23:20:08 UTC 2019

> On Feb 26, 2019, at 5:53 PM, zgu at redhat.com wrote:
> Yes, we current use other mechanism to initialize worker's gclab, so it
> works correctly right now. I were hoping I could use on_thread_xxx
> mechanism to replace our mechanism, so we can simplify a few things.
> I still have a couple of concerns regarding current on_thread_xxx
> implementation.
> 1) on_thread_create() callback, actually sees partially constructed
> thread if the thread is a subclass of Thread.

(Since Thread is (at least conceptually) abstract, the object is
necessarily an instance of a derived class.)

on_thread_create is intended to be called as part of construction.
Similarly on_thread_destroy and destruction.

> 2) For JavaThread, on_thread_attach() is called from creator's thread,
> but non-Java thread is from the thread itself.

If this is a problem, you could add a handshake between the creator
and the new thread's run function, so the creator knows the new thread
has been added to the thread list before proceeding to use it.

More information about the hotspot-gc-dev mailing list