summaryrefslogtreecommitdiff
path: root/main/lock.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2012-11-23 00:02:23 +0000
committerMatthew Jordan <mjordan@digium.com>2012-11-23 00:02:23 +0000
commit588e90a4d9ca1bdda152faa04a661af5e68aad8b (patch)
treeb8d8d737c367fba63023eee05ac42b2c4b21f4f0 /main/lock.c
parent4ccf2c7aa5e8be4a7f38170c3e7a3d1fa5beed9c (diff)
Re-initialize logmsgs mutex upon logger initialization to prevent lock errors
Similar to the patch that moved the fork earlier in the startup sequence to prevent mutex errors in the recursive mutex surrounding the read/write thread registration lock, this patch re-initializes the logmsgs mutex. Part of the start up sequence before forking the process into the background includes reading asterisk.conf; this has to occur prior to the call to daemon in order to read startup parameters. When reading in a conf file, log statements can be generated. Since this can't be avoided, the mutex instead is re-initialized to ensure a reset of any thread tracking information. This patch also includes some additional debugging to catch errors when locking or unlocking the recursive mutex that surrounds locks when the DEBUG_THREADS build option is enabled. DO_CRASH or THREAD_CRASH will cause an abort() if a mutex error is detected. (issue ASTERISK-19463) Reported by: mjordan Tesetd by: mjordan ........ Merged revisions 376586 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 376587 from http://svn.asterisk.org/svn/asterisk/branches/10 ........ Merged revisions 376588 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@376589 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/lock.c')
-rw-r--r--main/lock.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/main/lock.c b/main/lock.c
index eef5d8621..3c9fbd4db 100644
--- a/main/lock.c
+++ b/main/lock.c
@@ -51,8 +51,8 @@ int __ast_pthread_mutex_init(int tracking, const char *filename, int lineno, con
int res;
pthread_mutexattr_t attr;
- t->track = NULL;
#ifdef DEBUG_THREADS
+ t->track = NULL;
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
/*