aboutsummaryrefslogtreecommitdiffstats
path: root/main/logger.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-10 13:46:57 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-10-10 13:46:57 +0000
commit407036a9d848c32fd0a0a165d1d92f9ad24a9dfb (patch)
tree2fa725723f2e18ea1ffe104062fba9fce86a47bd /main/logger.c
parent5a859995e0473177e8dd4fef1c812dde2efe5430 (diff)
Process outstanding log messages before shutting down the logger thread.
(closes issue #10933) Reported by: sperreault git-svn-id: http://svn.digium.com/svn/asterisk/trunk@85234 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/logger.c')
-rw-r--r--main/logger.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/main/logger.c b/main/logger.c
index a74cfa31e..fae61d454 100644
--- a/main/logger.c
+++ b/main/logger.c
@@ -859,10 +859,6 @@ static void *logger_thread(void *data)
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 @@ static void *logger_thread(void *data)
/* Free the data since we are done */
free(msg);
}
+
+ /* If we should stop, then stop */
+ if (close_logger_thread)
+ break;
}
return NULL;
@@ -937,6 +937,9 @@ void close_logger(void)
ast_cond_signal(&logcond);
AST_LIST_UNLOCK(&logmsgs);
+ if (logthread != AST_PTHREADT_NULL)
+ pthread_join(logthread, NULL);
+
AST_RWLIST_WRLOCK(&logchannels);
if (eventlog) {