aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-18 02:41:36 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-18 02:41:36 +0000
commit3ca018c3deb3adcbbd928d7734bf23f9bb935881 (patch)
tree0b7aa8b77185703fdc1a2dcabff61ef033a9a0fa /main
parent84c4852f6206a356141636a4eb09f7787103a3c1 (diff)
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: http://svn.digium.com/svn/asterisk/branches/1.4@45441 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/channel.c28
1 files changed, 6 insertions, 22 deletions
diff --git a/main/channel.c b/main/channel.c
index 4bb49603c..fb0d7464c 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -4468,17 +4468,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))
ast_log(LOG_DEBUG, ":::=== Still have %d locks (recursive)\n", count);
#endif
if (!res)
@@ -4508,13 +4500,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))
ast_log(LOG_DEBUG, ":::=== Now have %d locks (recursive)\n", count);
#endif
if (!res)
@@ -4544,13 +4532,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))
ast_log(LOG_DEBUG, ":::=== Now have %d locks (recursive)\n", count);
#endif
if (!res)