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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Nov 8 08:54:01 CST 2012


Author: mjordan
Date: Thu Nov  8 08:53:56 2012
New Revision: 376027

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376027
Log:
Switch our pthread_mutex_lock to pthread_mutex_trylock

SO... getting an EAGAIN back from pthread_mutex_lock is no bueno.  Back
off for a bit and try again.  We'll see how that works out.

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=376027&r1=376026&r2=376027
==============================================================================
--- team/mjordan/trunk-deadlock/include/asterisk/lock.h (original)
+++ team/mjordan/trunk-deadlock/include/asterisk/lock.h Thu Nov  8 08:53:56 2012
@@ -431,9 +431,12 @@
 static inline void ast_reentrancy_lock(struct ast_lock_track *lt)
 {
 	int res;
-	res = pthread_mutex_lock(&lt->reentr_mutex);
-	if (res) {
+	while ((res = pthread_mutex_trylock(&lt->reentr_mutex))) {
 		fprintf(stderr, "Failed to lock reentrancy mutex: %s[%d]\n", strerror(res), res);
+		if (res == EINVAL) {
+			break;
+		}
+		usleep(10);
 	}
 }
 




More information about the asterisk-commits mailing list