From 1ff876da3c8316ebe4a39e29b5db697953421511 Mon Sep 17 00:00:00 2001 From: Carl Shapiro Date: Sun, 4 Apr 2010 01:56:48 -0700 Subject: [PATCH] Unlock the monitor mutex before destroying it. This resolves an issue 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vm/Sync.c b/vm/Sync.c index c00a630bc..c9624d0cd 100644 --- 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); -- 2.11.0