From 812e6b1a6485e4468bc88fd69e9304817b8192dd Mon Sep 17 00:00:00 2001 From: Ben Cheng Date: Mon, 15 Mar 2010 15:19:06 -0700 Subject: Fix the JIT blocking mode to unblock itself. Change-Id: Iaf1da9ee3ce337f2c5ad4985a6c776bc68472f8c --- vm/compiler/Compiler.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'vm/compiler/Compiler.c') 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); -- cgit v1.2.3