< prev index next >

src/share/vm/runtime/vmThread.cpp

Print this page

        

*** 306,319 **** MutexLockerEx ml(_terminate_lock, Mutex::_no_safepoint_check_flag); _terminated = true; _terminate_lock->notify(); } ! // Deletion must be done synchronously by the JNI DestroyJavaVM thread ! // so that the VMThread deletion completes before the main thread frees ! // up the CodeHeap. } // Notify the VMThread that the last non-daemon JavaThread has terminated, // and wait until operation is performed. --- 306,323 ---- MutexLockerEx ml(_terminate_lock, Mutex::_no_safepoint_check_flag); _terminated = true; _terminate_lock->notify(); } ! // Deletion is done synchronously by the JNI DestroyJavaVM thread ! // so that the VMThread deletion doesn't race with that thread as it ! // tears down VM resources. That means 'this' may already have been ! // deallocated so we can't reference it. However we must do some cleanup ! // ourselves before allowing the native thread to terminate + ThreadLocalStorage::set_thread(NULL); + } // Notify the VMThread that the last non-daemon JavaThread has terminated, // and wait until operation is performed.
< prev index next >