Add errors that report any locks held by threads when they are being closed.
authorBrett Bryant <bbryant@digium.com>
Thu, 19 Jun 2008 19:48:26 +0000 (19:48 +0000)
committerBrett Bryant <bbryant@digium.com>
Thu, 19 Jun 2008 19:48:26 +0000 (19:48 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@124064 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/utils.c

index b043b61..4b98699 100644 (file)
@@ -574,11 +574,25 @@ static AST_LIST_HEAD_NOLOCK_STATIC(lock_infos, thr_lock_info);
 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)
                free((void *) lock_info->thread_name);