summaryrefslogtreecommitdiffstats
path: root/vm/compiler
diff options
context:
space:
mode:
authorBen Cheng <bccheng@android.com>2010-03-15 15:48:06 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-03-15 15:48:06 -0700
commit1639f7054fd7056a089fabe57d02639973d7da10 (patch)
tree7d1687129e1e4c3c6013ac92d2456118ef53e097 /vm/compiler
parenta58fc61670d91cad6eab32b665742a7ce956aebb (diff)
parent812e6b1a6485e4468bc88fd69e9304817b8192dd (diff)
downloadandroid_dalvik-1639f7054fd7056a089fabe57d02639973d7da10.tar.gz
android_dalvik-1639f7054fd7056a089fabe57d02639973d7da10.tar.bz2
android_dalvik-1639f7054fd7056a089fabe57d02639973d7da10.zip
Merge "Fix the JIT blocking mode to unblock itself."
Diffstat (limited to 'vm/compiler')
-rw-r--r--vm/compiler/Compiler.c8
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);