8159461: bigapps/Kitchensink/stressExitCode hits assert: Must be VMThread or JavaThread

Reviewed-by: fparain, simonis, dcubed
This commit is contained in:
David Holmes 2016-08-12 00:19:44 -04:00
parent 19d25373bf
commit 74e840d64c
4 changed files with 54 additions and 10 deletions

View file

@ -374,11 +374,14 @@ Thread::~Thread() {
delete handle_area();
delete metadata_handles();
// SR_handler uses this as a termination indicator -
// needs to happen before os::free_thread()
delete _SR_lock;
_SR_lock = NULL;
// osthread() can be NULL, if creation of thread failed.
if (osthread() != NULL) os::free_thread(osthread());
delete _SR_lock;
// clear Thread::current if thread is deleting itself.
// Needed to ensure JNI correctly detects non-attached threads.
if (this == Thread::current()) {