diff options
Diffstat (limited to 'vm/compiler')
-rw-r--r-- | vm/compiler/Compiler.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/vm/compiler/Compiler.c b/vm/compiler/Compiler.c index 0380e02d2..bd12e5689 100644 --- a/vm/compiler/Compiler.c +++ b/vm/compiler/Compiler.c @@ -118,7 +118,13 @@ void dvmCompilerDrainQueue(void) int oldStatus = dvmChangeStatus(NULL, THREAD_VMWAIT); dvmLockMutex(&gDvmJit.compilerLock); while (workQueueLength() != 0 && !gDvmJit.haltCompilerThread) { - pthread_cond_wait(&gDvmJit.compilerQueueEmpty, &gDvmJit.compilerLock); + /* + * Use timed wait here - more than one mutator threads may be blocked + * but the compiler thread will only signal once when the queue is + * emptied. Furthermore, the compiler thread may have been shutdown + * so the blocked thread may never get the wakeup signal. + */ + dvmRelativeCondWait(&gDvmJit.compilerQueueEmpty, &gDvmJit.compilerLock, 1000, 0); } dvmUnlockMutex(&gDvmJit.compilerLock); dvmChangeStatus(NULL, oldStatus); |