]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Fix an issue where DEBUG_THREADS may erroneously report that a thread
authorRussell Bryant <russell@russellbryant.com>
Tue, 16 Dec 2008 21:38:29 +0000 (21:38 +0000)
committerRussell Bryant <russell@russellbryant.com>
Tue, 16 Dec 2008 21:38:29 +0000 (21:38 +0000)
is exiting while holding a lock.

If the last lock attempt was a trylock, and it failed, it will still be in the
list of locks so that it can be reported.

(closes issue #13219)
Reported by: pj

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@164881 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/utils.c

index a8d15bba0c5016686f6362d5bc79fa034a26c664..bbebe8b35028e52c77ee323f188c2b65b76bb0a3 100644 (file)
@@ -515,6 +515,12 @@ static void lock_info_destroy(void *data)
 
 
        for (i = 0; i < lock_info->num_locks; i++) {
+               if (lock_info->locks[i].pending == -1) {
+                       /* This just means that the last lock this thread went for was by
+                        * using trylock, and it failed.  This is fine. */
+                       break;
+               }
+
                ast_log(LOG_ERROR, 
                        "Thread '%s' still has a lock! - '%s' (%p) from '%s' in %s:%d!\n", 
                        lock_info->thread_name,