[asterisk-commits] mjordan: branch mjordan/trunk-deadlock r376584 - in /team/mjordan/trunk-deadl...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Nov 21 21:52:27 CST 2012
Author: mjordan
Date: Wed Nov 21 21:52:23 2012
New Revision: 376584
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376584
Log:
Re-init logger mutex
Modified:
team/mjordan/trunk-deadlock/include/asterisk/lock.h
team/mjordan/trunk-deadlock/main/lock.c
team/mjordan/trunk-deadlock/main/logger.c
Modified: team/mjordan/trunk-deadlock/include/asterisk/lock.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/include/asterisk/lock.h?view=diff&rev=376584&r1=376583&r2=376584
==============================================================================
--- team/mjordan/trunk-deadlock/include/asterisk/lock.h (original)
+++ team/mjordan/trunk-deadlock/include/asterisk/lock.h Wed Nov 21 21:52:23 2012
@@ -431,7 +431,9 @@
int res;
if ((res = pthread_mutex_lock(<->reentr_mutex))) {
fprintf(stderr, "ast_reentrancy_lock failed with error: %s\n", strerror(res));
+#if defined(DO_CRASH) || defined(THREAD_CRASH)
abort();
+#endif
}
}
@@ -440,7 +442,9 @@
int res;
if ((res = pthread_mutex_unlock(<->reentr_mutex))) {
fprintf(stderr, "ast_reentrancy_unlock failed with error: %s\n", strerror(res));
+#if defined(DO_CRASH) || defined(THREAD_CRASH)
abort();
+#endif
}
}
Modified: team/mjordan/trunk-deadlock/main/lock.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/main/lock.c?view=diff&rev=376584&r1=376583&r2=376584
==============================================================================
--- team/mjordan/trunk-deadlock/main/lock.c (original)
+++ team/mjordan/trunk-deadlock/main/lock.c Wed Nov 21 21:52:23 2012
@@ -51,8 +51,13 @@
int res;
pthread_mutexattr_t attr;
+#ifdef DEBUG_THREADS
+
+ if (t->track) {
+ delete_reentrancy_cs(&t->track);
+ }
t->track = NULL;
-#ifdef DEBUG_THREADS
+
#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS) && defined(CAN_COMPARE_MUTEX_TO_INIT_VALUE)
if ((t->mutex) != ((pthread_mutex_t) PTHREAD_MUTEX_INITIALIZER)) {
/*
@@ -704,6 +709,9 @@
}
#endif /* AST_MUTEX_INIT_W_CONSTRUCTORS */
+ if (t->track) {
+ delete_reentrancy_cs(&t->track);
+ }
if ((t->tracking = tracking)) {
ast_reentrancy_init(&t->track);
}
Modified: team/mjordan/trunk-deadlock/main/logger.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/main/logger.c?view=diff&rev=376584&r1=376583&r2=376584
==============================================================================
--- team/mjordan/trunk-deadlock/main/logger.c (original)
+++ team/mjordan/trunk-deadlock/main/logger.c Wed Nov 21 21:52:23 2012
@@ -1040,8 +1040,6 @@
struct verb *v = NULL;
int level = 0;
- ast_assert(g_multi_thread_safe);
-
if (logmsg->level == __LOG_VERBOSE) {
char *tmpmsg = ast_strdupa(logmsg->message + 1);
level = VERBOSE_MAGIC2LEVEL(logmsg->message);
@@ -1228,6 +1226,9 @@
/* auto rotate if sig SIGXFSZ comes a-knockin */
sigaction(SIGXFSZ, &handle_SIGXFSZ, NULL);
+ /* re-initialize the logger mutex */
+ ast_mutex_init(&logmsgs.lock);
+
/* start logger thread */
ast_cond_init(&logcond, NULL);
if (ast_pthread_create(&logthread, NULL, logger_thread, NULL) < 0) {
@@ -1490,7 +1491,7 @@
}
AST_LIST_UNLOCK(&logmsgs);
} else {
- /*logger_print_normal(logmsg);*/
+ logger_print_normal(logmsg);
logmsg_free(logmsg);
}
return;
More information about the asterisk-commits
mailing list