[asterisk-commits] mjordan: branch mjordan/trunk-deadlock r376520 - in /team/mjordan/trunk-deadl...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Nov 20 08:20:34 CST 2012


Author: mjordan
Date: Tue Nov 20 08:20:31 2012
New Revision: 376520

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=376520
Log:
Don't log things if we aren't ready to do so

Modified:
    team/mjordan/trunk-deadlock/include/asterisk.h
    team/mjordan/trunk-deadlock/main/asterisk.c
    team/mjordan/trunk-deadlock/main/logger.c

Modified: team/mjordan/trunk-deadlock/include/asterisk.h
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/include/asterisk.h?view=diff&rev=376520&r1=376519&r2=376520
==============================================================================
--- team/mjordan/trunk-deadlock/include/asterisk.h (original)
+++ team/mjordan/trunk-deadlock/include/asterisk.h Tue Nov 20 08:20:31 2012
@@ -213,6 +213,8 @@
 struct ast_str;
 struct ast_sched_context;
 
+int g_multi_thread_safe;
+
 #ifdef bzero
 #undef bzero
 #endif

Modified: team/mjordan/trunk-deadlock/main/asterisk.c
URL: http://svnview.digium.com/svn/asterisk/team/mjordan/trunk-deadlock/main/asterisk.c?view=diff&rev=376520&r1=376519&r2=376520
==============================================================================
--- team/mjordan/trunk-deadlock/main/asterisk.c (original)
+++ team/mjordan/trunk-deadlock/main/asterisk.c Tue Nov 20 08:20:31 2012
@@ -395,7 +395,7 @@
 static pthread_t mon_sig_flags;
 static int canary_pid = 0;
 static char canary_filename[128];
-static int multi_thread_safe;
+/*static int multi_thread_safe;*/
 
 static char randompool[256];
 
@@ -504,7 +504,7 @@
 	if (!new)
 		return;
 
-	ast_assert(multi_thread_safe);
+	ast_assert(g_multi_thread_safe);
 	new->id = pthread_self();
 	new->lwp = ast_get_tid();
 	new->name = name; /* steal the allocated memory for the thread name */
@@ -3921,7 +3921,7 @@
 	if (ast_tryconnect()) {
 		/* One is already running */
 		if (ast_opt_remote) {
-			multi_thread_safe = 1;
+			g_multi_thread_safe = 1;
 			if (ast_opt_exec) {
 				ast_remotecontrol(xarg);
 				quit_handler(0, SHUTDOWN_FAST, 0);
@@ -3963,7 +3963,7 @@
 	/* At this point everything has been forked successfully,
 	 * we have determined that we aren't attempting to connect to
 	 * an Asterisk instance, and that there isn't one already running. */
-	multi_thread_safe = 1;
+	g_multi_thread_safe = 1;
 
 	/* Spawning of astcanary must happen AFTER the call to daemon(3) */
 	if (isroot && ast_opt_high_priority) {

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=376520&r1=376519&r2=376520
==============================================================================
--- team/mjordan/trunk-deadlock/main/logger.c (original)
+++ team/mjordan/trunk-deadlock/main/logger.c Tue Nov 20 08:20:31 2012
@@ -1040,6 +1040,8 @@
 	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);
@@ -1488,9 +1490,10 @@
 		}
 		AST_LIST_UNLOCK(&logmsgs);
 	} else {
-		logger_print_normal(logmsg);
+		/*logger_print_normal(logmsg);*/
 		logmsg_free(logmsg);
 	}
+	return;
 }
 
 void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)




More information about the asterisk-commits mailing list