Browse files

enter exclusive state in destroyJavaVM

This is necessary to ensure that new threads do not start while we're
shutting down (except for the ones that we start to run the shutdown
hooks), and that the shutdown hook threads can be safely started (it
is not safe to start threads from e.g. an idle state, and an assertion
will fail if we do).
  • Loading branch information...
1 parent 45e4a6b commit 9f8369c5cc03d5a0121ed644c0fbb64a2360f7ed @dicej dicej committed Apr 15, 2013
Showing with 2 additions and 0 deletions.
  1. +2 −0 src/jnienv.cpp
2 src/jnienv.cpp
@@ -79,6 +79,8 @@ destroyJavaVM(Thread* t, uintptr_t*)
while (t->m->liveCount - t->m->daemonCount > 1) {
t->m->stateLock->wait(t->systemThread, 0);
+ enter(t, Thread::ExclusiveState);

0 comments on commit 9f8369c

Please sign in to comment.