summaryrefslogtreecommitdiff
path: root/main/utils.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2007-10-29 20:24:47 +0000
committerRussell Bryant <russell@russellbryant.com>2007-10-29 20:24:47 +0000
commitf7782d60d1da9bffec048fec5a42c94ee17236f6 (patch)
tree8a565171c0a15668d5e7f4b6541d94c8433a47eb /main/utils.c
parent3ffc123db936c72b6bdb5ab98848284c6bc2637b (diff)
Merged revisions 87396 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r87396 | russell | 2007-10-29 15:22:07 -0500 (Mon, 29 Oct 2007) | 5 lines 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: https://origsvn.digium.com/svn/asterisk/trunk@87397 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/utils.c')
-rw-r--r--main/utils.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/main/utils.c b/main/utils.c
index 8e7808406..ccc21f537 100644
--- a/main/utils.c
+++ b/main/utils.c
@@ -749,6 +749,9 @@ static char *handle_show_locks(struct ast_cli_entry *e, int cmd, struct ast_cli_
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_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,
@@ -758,6 +761,18 @@ static char *handle_show_locks(struct ast_cli_entry *e, int cmd, struct ast_cli_
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_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)