mirror of
https://github.com/corda/corda.git
synced 2025-06-13 12:48:18 +00:00
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:
@ -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);
|
||||
|
Reference in New Issue
Block a user