[asterisk-commits] mjordan: branch mjordan/trunk-deadlock r376571 - in /team/mjordan/trunk-deadl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 20 20:49:14 CST 2012


Author: mjordan
Date: Tue Nov 20 20:49:10 2012
New Revision: 376571

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376571
Log:
Make ast_reentrancy_*lock bomb (again)

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

Modified: team/mjordan/trunk-deadlock/include/asterisk.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/include/asterisk.h?view=diff&rev=376571&r1=376570&r2=376571
==============================================================================
--- team/mjordan/trunk-deadlock/include/asterisk.h (original)
+++ team/mjordan/trunk-deadlock/include/asterisk.h Tue Nov 20 20:49:10 2012
@@ -76,6 +76,8 @@
 #endif
 #endif
 
+extern int g_multi_thread_safe;
+
 int ast_set_priority(int);			/*!< Provided by asterisk.c */
 int ast_fd_init(void);				/*!< Provided by astfd.c */
 int ast_pbx_init(void);				/*!< Provided by pbx.c */
@@ -213,8 +215,6 @@
 struct ast_str;
 struct ast_sched_context;
 
-int g_multi_thread_safe;
-
 #ifdef bzero
 #undef bzero
 #endif

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=376571&r1=376570&r2=376571
==============================================================================
--- team/mjordan/trunk-deadlock/include/asterisk/lock.h (original)
+++ team/mjordan/trunk-deadlock/include/asterisk/lock.h Tue Nov 20 20:49:10 2012
@@ -428,12 +428,20 @@
 
 static inline void ast_reentrancy_lock(struct ast_lock_track *lt)
 {
-	pthread_mutex_lock(&lt->reentr_mutex);
+	int res;
+	if ((res = pthread_mutex_lock(&lt->reentr_mutex))) {
+		fprintf(stderr, "ast_reentrancy_lock failed with error: %s\n", strerror(res));
+		abort();
+	}
 }
 
 static inline void ast_reentrancy_unlock(struct ast_lock_track *lt)
 {
-	pthread_mutex_unlock(&lt->reentr_mutex);
+	int res;
+	if ((res = pthread_mutex_unlock(&lt->reentr_mutex))) {
+		fprintf(stderr, "ast_reentrancy_unlock failed with error: %s\n", strerror(res));
+		abort();
+	}
 }
 
 static inline void ast_reentrancy_init(struct ast_lock_track **plt)




More information about the asterisk-commits mailing list