[asterisk-commits] mmichelson: branch 1.6.0 r176175 - in /branches/1.6.0: ./ main/logger.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 16 12:33:05 CST 2009
Author: mmichelson
Date: Mon Feb 16 12:33:05 2009
New Revision: 176175
URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=176175
Log:
Merged revisions 176174 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r176174 | mmichelson | 2009-02-16 12:25:57 -0600 (Mon, 16 Feb 2009) | 11 lines
Assist proper thread synchronization when stopping the logger thread.
I was finding that on my dev box, occasionally attempting to "stop now" in
trunk would cause Asterisk to hang. I traced this to the fact that the logger
thread was waiting on a condition which had already been signalled. The logger
thread also need to be sure to check the value of the close_logger_thread variable.
The close_logger_thread variable is only checked when the list of logmessages is empty.
This allows for the logger thread to print and free any pending messages before exiting.
........
Modified:
branches/1.6.0/ (props changed)
branches/1.6.0/main/logger.c
Propchange: branches/1.6.0/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.0/main/logger.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.6.0/main/logger.c?view=diff&rev=176175&r1=176174&r2=176175
==============================================================================
--- branches/1.6.0/main/logger.c (original)
+++ branches/1.6.0/main/logger.c Mon Feb 16 12:33:05 2009
@@ -881,8 +881,13 @@
for (;;) {
/* We lock the message list, and see if any message exists... if not we wait on the condition to be signalled */
AST_LIST_LOCK(&logmsgs);
- if (AST_LIST_EMPTY(&logmsgs))
- ast_cond_wait(&logcond, &logmsgs.lock);
+ if (AST_LIST_EMPTY(&logmsgs)) {
+ if (close_logger_thread) {
+ break;
+ } else {
+ ast_cond_wait(&logcond, &logmsgs.lock);
+ }
+ }
next = AST_LIST_FIRST(&logmsgs);
AST_LIST_HEAD_INIT_NOLOCK(&logmsgs);
AST_LIST_UNLOCK(&logmsgs);
More information about the asterisk-commits
mailing list