RFR: 8154715: Missing destructor and/or TLS clearing calls for terminating threads

David Holmes david.holmes at oracle.com
Tue May 10 00:33:30 UTC 2016

Okay here is version 2:


Lots of cosmetic changes but only a couple of functional ones:

-  After thread->run() returns we clear the TLS by calling 
clear_thread_current(), but only for threads where it has not already 
been cleared - as those threads may already have been deleted so we 
can't dereference 'thread'

- No asynchronous thread deletion is permitted, and we avoid races with 
VM termination. This means the VMThread no longer gets deleted - that 
should not be an issue as many threads do not get deleted when the VM 
terminates. I added destructors for the VMThread and WatcherThread so 
anyone introducing their deletion is informed by a guarantee(false)

Cosmetic changes:

- renamed java_start to thread_native_entry (it is used by all threads 
not just "java" ones, so this avoids potential confusion)

- updated os::free_thread to always assume it works on the current 
thread (and add assert to verify that)


More information about the hotspot-dev mailing list