aboutsummaryrefslogtreecommitdiffstats
path: root/main/astmm.c
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-03 19:39:49 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-08-03 19:39:49 +0000
commitfe2c3636c641e3f809e9f379ab8be6968da0a23d (patch)
treea20555fe6f3d22f344495561772f588936af35aa /main/astmm.c
parent3c9926564876068a02dc155b6f06e225cd88fe70 (diff)
Add some improvements to lock debugging. These changes take effect
with DEBUG_THREADS enabled and provide the following: * This will keep track of which locks are held by which thread as well as which lock a thread is waiting for in a thread-local data structure. A reference to this structure is available on the stack in the dummy_start() function, which is the common entry point for all threads. This information can be easily retrieved using gdb if you switch to the dummy_start() stack frame of any thread and print the contents of the lock_info variable. * All of the thread-local structures for keeping track of this lock information are also stored in a list so that the information can be dumped to the CLI using the "core show locks" CLI command. This introduces a little bit of a performance hit as it requires additional underlying locking operations inside of every lock/unlock on an ast_mutex. However, the benefits of having this information available at the CLI is huge, especially considering this is only done in DEBUG_THREADS mode. It means that in most cases where we debug deadlocks, we no longer have to request access to the machine to analyze the contents of ast_mutex_t structures. We can now just ask them to get the output of "core show locks", which gives us all of the information we needed in most cases. I also had to make some additional changes to astmm.c to make this work when both MALLOC_DEBUG and DEBUG_THREADS are enabled. I disabled tracking of one of the locks in astmm.c because it gets used inside the replacement memory allocation routines, and the lock tracking code allocates memory. This caused infinite recursion. git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@78095 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/astmm.c')
-rw-r--r--main/astmm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/astmm.c b/main/astmm.c
index 948d26e6a..b29502542 100644
--- a/main/astmm.c
+++ b/main/astmm.c
@@ -81,7 +81,7 @@ static struct ast_region {
#define HASH(a) \
(((unsigned long)(a)) % SOME_PRIME)
-AST_MUTEX_DEFINE_STATIC(reglock);
+AST_MUTEX_DEFINE_STATIC_NOTRACKING(reglock);
AST_MUTEX_DEFINE_STATIC(showmemorylock);
#define astmm_log(...) \