8186437: Lock held when compiler thread creation fails
Reviewed-by: stuefe, kvn
This commit is contained in:
parent
d1bbcb5a39
commit
192f57c11c
@ -720,12 +720,10 @@ JavaThread* CompileBroker::make_thread(const char* name, CompileQueue* queue, Co
|
||||
// At this point it may be possible that no osthread was created for the
|
||||
// JavaThread due to lack of memory. We would have to throw an exception
|
||||
// in that case. However, since this must work and we do not allow
|
||||
// exceptions anyway, check and abort if this fails.
|
||||
// exceptions anyway, check and abort if this fails. But first release the
|
||||
// lock.
|
||||
|
||||
if (thread == NULL || thread->osthread() == NULL) {
|
||||
vm_exit_during_initialization("java.lang.OutOfMemoryError",
|
||||
os::native_thread_creation_failed_msg());
|
||||
}
|
||||
if (thread != NULL && thread->osthread() != NULL) {
|
||||
|
||||
java_lang_Thread::set_thread(thread_oop(), thread);
|
||||
|
||||
@ -759,6 +757,13 @@ JavaThread* CompileBroker::make_thread(const char* name, CompileQueue* queue, Co
|
||||
Threads::add(thread);
|
||||
Thread::start(thread);
|
||||
}
|
||||
}
|
||||
|
||||
// First release lock before aborting VM.
|
||||
if (thread == NULL || thread->osthread() == NULL) {
|
||||
vm_exit_during_initialization("java.lang.OutOfMemoryError",
|
||||
os::native_thread_creation_failed_msg());
|
||||
}
|
||||
|
||||
// Let go of Threads_lock before yielding
|
||||
os::naked_yield(); // make sure that the compiler thread is started early (especially helpful on SOLARIS)
|
||||
|
Loading…
x
Reference in New Issue
Block a user