wait for other threads to exit in DestroyJavaVM

This commit is contained in:
Joel Dice 2008-08-13 15:39:48 -06:00
parent 86dfaf9ff0
commit e46e222f38

View File

@ -34,6 +34,14 @@ DestroyJavaVM(Machine* m)
Finder* f = m->finder;
Thread* t = m->rootThread;
// wait for other threads to exit
{ ACQUIRE(t, m->stateLock);
while (m->liveCount > 1) {
t->m->stateLock->wait(t->systemThread, 0);
}
}
int exitCode = (t->exception ? -1 : 0);
enter(t, Thread::ActiveState);
t->exit();