]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Make the lock protecting each thread's list of locks it currently holds
authorRussell Bryant <russell@russellbryant.com>
Fri, 7 Dec 2007 21:24:33 +0000 (21:24 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 7 Dec 2007 21:24:33 +0000 (21:24 +0000)
recursive.  I think that this will fix the situation where some people have
said that "core show locks" locks up the CLI.
(related to issue #11080)

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

main/utils.c

index 165353edd6dda8c61ee0c1d5aa8905c5d7cd5017..e464f728451ee429e745d439282e8620d262c435 100644 (file)
@@ -820,6 +820,7 @@ static void *dummy_start(void *data)
        struct thr_arg a = *((struct thr_arg *) data);  /* make a local copy */
 #ifdef DEBUG_THREADS
        struct thr_lock_info *lock_info;
+       pthread_mutexattr_t mutex_attr;
 #endif
 
        /* note that even though data->name is a pointer to allocated memory,
@@ -837,7 +838,11 @@ static void *dummy_start(void *data)
 
        lock_info->thread_id = pthread_self();
        lock_info->thread_name = strdup(a.name);
-       pthread_mutex_init(&lock_info->lock, NULL);
+
+       pthread_mutexattr_init(&mutex_attr);
+       pthread_mutexattr_settype(&mutex_attr, AST_MUTEX_KIND);
+       pthread_mutex_init(&lock_info->lock, &mutex_attr);
+       pthread_mutexattr_destroy(&mutex_attr);
 
        pthread_mutex_lock(&lock_infos_lock.mutex); /* Intentionally not the wrapper */
        AST_LIST_INSERT_TAIL(&lock_infos, lock_info, entry);