From 5ccdf0be4b448c98b595444a77dbaa21471ad1b1 Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Thu, 8 Oct 2009 16:09:49 -0700 Subject: [PATCH] Fix for "Compiler thread shutdown should switch out of VMWAIT" --- vm/compiler/Compiler.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c index 39a988d94..074830fab 100644 --- a/vm/compiler/Compiler.c +++ b/vm/compiler/Compiler.c @@ -100,13 +100,14 @@ void dvmCompilerDrainQueue(void) static void *compilerThreadStart(void *arg) { + dvmChangeStatus(NULL, THREAD_VMWAIT); + dvmLockMutex(&gDvmJit.compilerLock); /* * Since the compiler thread will not touch any objects on the heap once * being created, we just fake its state as VMWAIT so that it can be a * bit late when there is suspend request pending. */ - dvmChangeStatus(NULL, THREAD_VMWAIT); while (!gDvmJit.haltCompilerThread) { if (workQueueLength() == 0) { int cc; @@ -143,6 +144,13 @@ static void *compilerThreadStart(void *arg) pthread_cond_signal(&gDvmJit.compilerQueueEmpty); dvmUnlockMutex(&gDvmJit.compilerLock); + /* + * As part of detaching the thread we need to call into Java code to update + * the ThreadGroup, and we should not be in VMWAIT state while executing + * interpreted code. + */ + dvmChangeStatus(NULL, THREAD_RUNNING); + LOGD("Compiler thread shutting down\n"); return NULL; } -- 2.11.0