[asterisk-commits] mjordan: branch mjordan/trunk-deadlock r376122 - /team/mjordan/trunk-deadlock...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Nov 9 16:34:08 CST 2012


Author: mjordan
Date: Fri Nov  9 16:34:05 2012
New Revision: 376122

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376122
Log:
Take a different approach.  Blow up if this fails so I can see the
backtrace from glibc

Modified:
    team/mjordan/trunk-deadlock/include/asterisk/lock.h

Modified: team/mjordan/trunk-deadlock/include/asterisk/lock.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/include/asterisk/lock.h?view=diff&rev=376122&r1=376121&r2=376122
==============================================================================
--- team/mjordan/trunk-deadlock/include/asterisk/lock.h (original)
+++ team/mjordan/trunk-deadlock/include/asterisk/lock.h Fri Nov  9 16:34:05 2012
@@ -431,13 +431,11 @@
 static inline void ast_reentrancy_lock(struct ast_lock_track *lt)
 {
 	int res;
-	while ((res = pthread_mutex_trylock(&lt->reentr_mutex))) {
-		if (res == EINVAL) {
-			break;
-		} else if (res == EAGAIN) {
-			fprintf(stderr, "Failed to lock reentrancy mutex: %s[%d]\n", strerror(res), res);
-		}
-		usleep(10);
+	res = pthread_mutex_lock(&lt->reentr_mutex);
+	if (res) {
+		fprintf(stderr, "Failed to lock reentrancy mutex: %s[%d]\n", strerror(res), res);
+		usleep(1);
+		abort();
 	}
 }
 
@@ -447,6 +445,8 @@
 	res = pthread_mutex_unlock(&lt->reentr_mutex);
 	if (res) {
 		fprintf(stderr, "Failed to unlock reentrancy mutex: %s[%d]\n", strerror(res), res);
+		usleep(1);
+		abort();
 	}
 }
 




More information about the asterisk-commits mailing list