[asterisk-commits] murf: trunk r77810 - /trunk/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 30 22:32:05 CDT 2007


Author: murf
Date: Mon Jul 30 22:32:04 2007
New Revision: 77810

URL: http://svn.digium.com/view/asterisk?view=rev&rev=77810
Log:
Discovered in experiments on core files: if you wrap the lock and unlock calls with sip_pvt_lock and sip_pvt_unlock, you lose the tracing info you would normally get via DETECT_DEADLOCKS; so I turn these two functions into macros when DETECT_DEADLOCKS is called. This way, you get meaningful stuff in the file and func slots in the lock_info struct.

Modified:
    trunk/channels/chan_sip.c

Modified: trunk/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_sip.c?view=diff&rev=77810&r1=77809&r2=77810
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Jul 30 22:32:04 2007
@@ -1841,6 +1841,7 @@
 	get_codec: sip_get_codec,
 };
 
+#ifndef DETECT_DEADLOCKS
 /*! \brief Helper function to lock, hiding the underlying locking mechanism.  */
 static void sip_pvt_lock(struct sip_pvt *pvt)
 {
@@ -1852,6 +1853,12 @@
 {
 	ast_mutex_unlock(&pvt->pvt_lock);
 }
+#else
+/* we don't want to HIDE the information about where the lock was requested if trying to debug 
+ * deadlocks!  So, just make these macros! */
+#define sip_pvt_lock(x) ast_mutex_lock(&x->pvt_lock)
+#define sip_pvt_unlock(x) ast_mutex_unlock(&x->pvt_lock)
+#endif
 
 /*!
  * helper functions to unreference various types of objects.




More information about the asterisk-commits mailing list