[asterisk-commits] bbryant: trunk r124064 - /trunk/main/utils.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jun 19 14:48:26 CDT 2008


Author: bbryant
Date: Thu Jun 19 14:48:26 2008
New Revision: 124064

URL: http://svn.digium.com/view/asterisk?view=rev&rev=124064
Log:
Add errors that report any locks held by threads when they are being closed.

Modified:
    trunk/main/utils.c

Modified: trunk/main/utils.c
URL: http://svn.digium.com/view/asterisk/trunk/main/utils.c?view=diff&rev=124064&r1=124063&r2=124064
==============================================================================
--- trunk/main/utils.c (original)
+++ trunk/main/utils.c Thu Jun 19 14:48:26 2008
@@ -574,10 +574,24 @@
 static void lock_info_destroy(void *data)
 {
 	struct thr_lock_info *lock_info = data;
+	int i;
 
 	pthread_mutex_lock(&lock_infos_lock.mutex);
 	AST_LIST_REMOVE(&lock_infos, lock_info, entry);
 	pthread_mutex_unlock(&lock_infos_lock.mutex);
+
+
+	for (i = 0; i < lock_info->num_locks; i++) {
+		ast_log(LOG_ERROR, 
+			"Thread '%s' still has a lock! - '%s' (%p) from '%s' in %s:%d!\n", 
+			lock_info->thread_name,
+			lock_info->locks[i].lock_name,
+			lock_info->locks[i].lock_addr,
+			lock_info->locks[i].func,
+			lock_info->locks[i].file,
+			lock_info->locks[i].line_num
+		);
+	}
 
 	pthread_mutex_destroy(&lock_info->lock);
 	if (lock_info->thread_name)




More information about the asterisk-commits mailing list