allow main thread to use DetachCurrentThread

When I originally implemented DetachCurrentThread, I assumed it didn't
make sense for the main thread to detach itself from the VM, and I was
concerned that allowing it might cause problems for any other threads
still attached.  However, detaching the main thread is allowed by the
JNI spec as of Java 2, and OpenJDK's java command does this just
before calling DestroyJavaVM.  Therefore, this commit ensures that the
VM doesn't abort if the main thread is detached.
This commit is contained in:
Joel Dice 2012-08-24 18:14:01 -06:00
parent bac4099acb
commit 1f1c3c4c41

View File

@ -45,8 +45,6 @@ DetachCurrentThread(Machine* m)
{
Thread* t = static_cast<Thread*>(m->localThread->get());
if (t) {
expect(t, t != m->rootThread);
m->localThread->set(0);
ACQUIRE_RAW(t, t->m->stateLock);