From: Russell Bryant Date: Wed, 18 Oct 2006 02:46:39 +0000 (+0000) Subject: Merged revisions 45441 via svnmerge from X-Git-Tag: 1.6.0-beta1~3^2~4373 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=40b8afd54ff39e85072d964681951fef17b7fe21;p=thirdparty%2Fasterisk.git Merged revisions 45441 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r45441 | russell | 2006-10-17 22:41:36 -0400 (Tue, 17 Oct 2006) | 7 lines 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) ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@45442 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/channel.c b/main/channel.c index 9a1b6dfcae..1a4f55dfde 100644 --- a/main/channel.c +++ b/main/channel.c @@ -4496,17 +4496,9 @@ int ast_channel_unlock(struct ast_channel *chan) 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__ - int count = 0; #ifdef DEBUG_THREADS - if ((count = chan->lock.mutex.__data.__count)) -#else - if ((count = chan->lock.__data.__count)) -#endif + int count = 0; + if ((count = chan->lock.reentrancy)) if (option_debug) ast_log(LOG_DEBUG, ":::=== Still have %d locks (recursive)\n", count); #endif @@ -4539,13 +4531,9 @@ int ast_channel_lock(struct ast_channel *chan) res = ast_mutex_lock(&chan->lock); if (option_debug > 3) { -#ifdef __linux__ - int count = 0; #ifdef DEBUG_THREADS - if ((count = chan->lock.mutex.__data.__count)) -#else - if ((count = chan->lock.__data.__count)) -#endif + int count = 0; + if ((count = chan->lock.reentrancy)) if (option_debug) ast_log(LOG_DEBUG, ":::=== Now have %d locks (recursive)\n", count); #endif @@ -4577,13 +4565,9 @@ int ast_channel_trylock(struct ast_channel *chan) res = ast_mutex_trylock(&chan->lock); if (option_debug > 2) { -#ifdef __linux__ - int count = 0; #ifdef DEBUG_THREADS - if ((count = chan->lock.mutex.__data.__count)) -#else - if ((count = chan->lock.__data.__count)) -#endif + int count = 0; + if ((count = chan->lock.reentrancy)) if (option_debug) ast_log(LOG_DEBUG, ":::=== Now have %d locks (recursive)\n", count); #endif