[asterisk-commits] file: trunk r85234 - /trunk/main/logger.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Oct 10 08:46:58 CDT 2007


Author: file
Date: Wed Oct 10 08:46:57 2007
New Revision: 85234

URL: http://svn.digium.com/view/asterisk?view=rev&rev=85234
Log:
Process outstanding log messages before shutting down the logger thread.
(closes issue #10933)
Reported by: sperreault

Modified:
    trunk/main/logger.c

Modified: trunk/main/logger.c
URL: http://svn.digium.com/view/asterisk/trunk/main/logger.c?view=diff&rev=85234&r1=85233&r2=85234
==============================================================================
--- trunk/main/logger.c (original)
+++ trunk/main/logger.c Wed Oct 10 08:46:57 2007
@@ -859,10 +859,6 @@
 		AST_LIST_HEAD_INIT_NOLOCK(&logmsgs);
 		AST_LIST_UNLOCK(&logmsgs);
 
-		/* If we should stop, then stop */
-		if (close_logger_thread)
-			break;
-
 		/* Otherwise go through and process each message in the order added */
 		while ((msg = next)) {
 			/* Get the next entry now so that we can free our current structure later */
@@ -877,6 +873,10 @@
 			/* Free the data since we are done */
 			free(msg);
 		}
+
+		/* If we should stop, then stop */
+		if (close_logger_thread)
+			break;
 	}
 
 	return NULL;
@@ -936,6 +936,9 @@
 	close_logger_thread = 1;
 	ast_cond_signal(&logcond);
 	AST_LIST_UNLOCK(&logmsgs);
+
+	if (logthread != AST_PTHREADT_NULL)
+		pthread_join(logthread, NULL);
 
 	AST_RWLIST_WRLOCK(&logchannels);
 




More information about the asterisk-commits mailing list