diff options
author | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-12 17:55:08 +0000 |
---|---|---|
committer | mmichelson <mmichelson@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-05-12 17:55:08 +0000 |
commit | 1345bbfeaf85be8f4c2b2fd45194344971d0ff2c (patch) | |
tree | 7f19dad4a707e89ed5db11b8999d1aafa75c4e23 /main/utils.c | |
parent | fe719747809ea27c9ad2c09d7768cafdcbcef53b (diff) |
Merged revisions 115735 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r115735 | mmichelson | 2008-05-12 12:51:14 -0500 (Mon, 12 May 2008) | 7 lines
If a thread holds no locks, do not print any information on the thread when issuing
a core show locks command. This will help to de-clutter output somewhat.
Russell said it would be fine to place this improvement in the 1.4 branch, so that's
why it's going here too.
........
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@115737 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/utils.c')
-rw-r--r-- | main/utils.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/main/utils.c b/main/utils.c index 65b0494eb..a34514b98 100644 --- a/main/utils.c +++ b/main/utils.c @@ -832,19 +832,21 @@ static char *handle_show_locks(struct ast_cli_entry *e, int cmd, struct ast_cli_ pthread_mutex_lock(&lock_infos_lock.mutex); AST_LIST_TRAVERSE(&lock_infos, lock_info, entry) { int i; - ast_str_append(&str, 0, "=== Thread ID: %d (%s)\n", (int) lock_info->thread_id, - lock_info->thread_name); - pthread_mutex_lock(&lock_info->lock); - for (i = 0; str && i < lock_info->num_locks; i++) { - append_lock_information(&str, lock_info, i); + if (lock_info->num_locks) { + ast_str_append(&str, 0, "=== Thread ID: %d (%s)\n", (int) lock_info->thread_id, + lock_info->thread_name); + pthread_mutex_lock(&lock_info->lock); + for (i = 0; str && i < lock_info->num_locks; i++) { + append_lock_information(&str, lock_info, i); + } + pthread_mutex_unlock(&lock_info->lock); + if (!str) + break; + ast_str_append(&str, 0, "=== -------------------------------------------------------------------\n" + "===\n"); + if (!str) + break; } - pthread_mutex_unlock(&lock_info->lock); - if (!str) - break; - ast_str_append(&str, 0, "=== -------------------------------------------------------------------\n" - "===\n"); - if (!str) - break; } pthread_mutex_unlock(&lock_infos_lock.mutex); |