OSDN Git Service

Unlock the monitor mutex before destroying it. This resolves an issue
authorCarl Shapiro <cshapiro@google.com>
Sun, 4 Apr 2010 08:56:48 +0000 (01:56 -0700)
committerCarl Shapiro <cshapiro@google.com>
Tue, 6 Apr 2010 01:03:16 +0000 (18:03 -0700)
with simulator builds where, unlike bionic, libc checks whether a
mutex is in the unlocked state before a destroy and returns EBUSY if
the check fails.  Until similar checks are added to bionic we now do a
trylock, unlock sequence in the assert statements so as not to confuse
the simulator build.

Change-Id: Iafa3c52edddb17b9a8a2c648c5fd3a58d5d77988

vm/Sync.c

index c00a630..c9624d0 100644 (file)
--- a/vm/Sync.c
+++ b/vm/Sync.c
@@ -310,7 +310,8 @@ static void freeObjectMonitor(Object* obj)
      * the object, in which case we've got some bad
      * native code somewhere.
      */
-    assert(dvmTryLockMutex(&mon->lock) == 0);
+    assert(pthread_mutex_trylock(&mon->lock) == 0);
+    assert(pthread_mutex_unlock(&mon->lock) == 0);
     dvmDestroyMutex(&mon->lock);
 #ifdef WITH_DEADLOCK_PREDICTION
     expandObjClear(&mon->historyChildren);