[svn-commits] russell: branch 1.4 r45441 - /branches/1.4/main/channel.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Tue Oct 17 19:41:37 MST 2006


Author: russell
Date: Tue Oct 17 21:41:36 2006
New Revision: 45441

URL: http://svn.digium.com/view/asterisk?rev=45441&view=rev
Log:
Don't attempt to access private data members of the pthread_mutex_t object,
because this does not work on all linux systems.  Instead, just access
the reentrancy field in the ast_mutex_info struct when DEBUG_THREADS is
enabled.  If DEBUG_CHANNEL_LOCKS is enabled, the developer probably has
DEBUG_THREADS on as well.
(issue #8139, me)

Modified:
    branches/1.4/main/channel.c

Modified: branches/1.4/main/channel.c
URL: http://svn.digium.com/view/asterisk/branches/1.4/main/channel.c?rev=45441&r1=45440&r2=45441&view=diff
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Tue Oct 17 21:41:36 2006
@@ -4468,17 +4468,9 @@
 	res = ast_mutex_unlock(&chan->lock);
 
 	if (option_debug > 2) {
-		/* Try to find counter if possible on your platform 
-			I've only found out how to do this on Linux
-			DEBUG_THREADS changes the lock structure
-		*/
-#ifdef __linux__
+#ifdef DEBUG_THREADS
 		int count = 0;
-#ifdef DEBUG_THREADS
-		if ((count = chan->lock.mutex.__data.__count))
-#else
-		if ((count = chan->lock.__data.__count))
-#endif
+		if ((count = chan->lock.reentrancy))
 			ast_log(LOG_DEBUG, ":::=== Still have %d locks (recursive)\n", count);
 #endif
 		if (!res)
@@ -4508,13 +4500,9 @@
 	res = ast_mutex_lock(&chan->lock);
 
 	if (option_debug > 3) {
-#ifdef __linux__
+#ifdef DEBUG_THREADS
 		int count = 0;
-#ifdef DEBUG_THREADS
-		if ((count = chan->lock.mutex.__data.__count))
-#else
-		if ((count = chan->lock.__data.__count))
-#endif
+		if ((count = chan->lock.reentrancy))
 			ast_log(LOG_DEBUG, ":::=== Now have %d locks (recursive)\n", count);
 #endif
 		if (!res)
@@ -4544,13 +4532,9 @@
 	res = ast_mutex_trylock(&chan->lock);
 
 	if (option_debug > 2) {
-#ifdef __linux__
+#ifdef DEBUG_THREADS
 		int count = 0;
-#ifdef DEBUG_THREADS
-		if ((count = chan->lock.mutex.__data.__count))
-#else
-		if ((count = chan->lock.__data.__count))
-#endif
+		if ((count = chan->lock.reentrancy))
 			ast_log(LOG_DEBUG, ":::=== Now have %d locks (recursive)\n", count);
 #endif
 		if (!res)



More information about the svn-commits mailing list