[asterisk-commits] mmichelson: trunk r115737 - /trunk/main/utils.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon May 12 12:55:09 CDT 2008


Author: mmichelson
Date: Mon May 12 12:55:08 2008
New Revision: 115737

URL: http://svn.digium.com/view/asterisk?view=rev&rev=115737
Log:
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.


........

Modified:
    trunk/main/utils.c

Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?view=diff&rev=115737&r1=115736&r2=115737
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Mon May 12 12:55:08 2008
@@ -832,19 +832,21 @@
 	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);
-		}
-		pthread_mutex_unlock(&lock_info->lock);
-		if (!str)
-			break;
-		ast_str_append(&str, 0, "=== -------------------------------------------------------------------\n"
-		               "===\n");
-		if (!str)
-			break;
+		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_infos_lock.mutex);
 




More information about the asterisk-commits mailing list