src/share/vm/runtime/java.cpp
Print this page
*** 428,437 ****
--- 428,439 ----
exit_procs = entry;
}
}
}
+ jint volatile vm_getting_terminated = 0;
+
// Note: before_exit() can be executed only once, if more than one threads
// are trying to shutdown the VM at the same time, only one thread
// can run before_exit() and all other threads must wait.
void before_exit(JavaThread * thread) {
#define BEFORE_EXIT_NOT_RUN 0
*** 458,467 ****
--- 460,471 ----
case BEFORE_EXIT_DONE:
return;
}
}
+ OrderAccess::release_store(&vm_getting_terminated, 1);
+
// The only difference between this and Win32's _onexit procs is that
// this version is invoked before any threads get killed.
ExitProc* current = exit_procs;
while (current != NULL) {
ExitProc* next = current->next();