aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-29 20:22:07 +0000
committerrussell <russell@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-29 20:22:07 +0000
commit74763c4fd58f86ea17e4926fc911cdd04a298ad9 (patch)
tree182065f03b6662a1233d55ae7b5a430a64c041ba /main
parent364d312df585d5c8226766db286127cf61023d5b (diff)
Add some more details to the output of "core show locks". When a thread
is waiting for a lock, this will now show the details about who currently has it locked. (inspired by issue #11100) git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@87396 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c
index 53f7bdfd2..6daa1948c 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -727,6 +727,9 @@ static int handle_show_locks(int fd, int argc, char *argv[])
lock_info->thread_name);
pthread_mutex_lock(&lock_info->lock);
for (i = 0; str && i < lock_info->num_locks; i++) {
+ int j;
+ ast_mutex_t *lock;
+
ast_dynamic_str_append(&str, 0, "=== ---> %sLock #%d (%s): %s %d %s %s %p (%d)\n",
lock_info->locks[i].pending > 0 ? "Waiting for " :
lock_info->locks[i].pending < 0 ? "Tried and failed to get " : "", i,
@@ -736,6 +739,18 @@ static int handle_show_locks(int fd, int argc, char *argv[])
lock_info->locks[i].func, lock_info->locks[i].lock_name,
lock_info->locks[i].lock_addr,
lock_info->locks[i].times_locked);
+
+ if (!lock_info->locks[i].pending)
+ continue;
+
+ lock = lock_info->locks[i].lock_addr;
+
+ ast_reentrancy_lock(lock);
+ for (j = 0; str && j < lock->reentrancy; j++) {
+ ast_dynamic_str_append(&str, 0, "=== --- ---> Locked Here: %s line %d (%s)\n",
+ lock->file[j], lock->lineno[j], lock->func[j]);
+ }
+ ast_reentrancy_unlock(lock);
}
pthread_mutex_unlock(&lock_info->lock);
if (!str)