[asterisk-commits] file: branch file/logqueue r42012 -
/team/file/logqueue/main/logger.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Mon Sep 4 20:37:33 MST 2006
Author: file
Date: Mon Sep 4 22:37:32 2006
New Revision: 42012
URL: http://svn.digium.com/view/asterisk?rev=42012&view=rev
Log:
Only use the queue if the logging thread is active, for cases where you are using "asterisk -r" for example then it will not be active and stuff can safely be sent out direct.
Modified:
team/file/logqueue/main/logger.c
Modified: team/file/logqueue/main/logger.c
URL: http://svn.digium.com/view/asterisk/team/file/logqueue/main/logger.c?rev=42012&r1=42011&r2=42012&view=diff
==============================================================================
--- team/file/logqueue/main/logger.c (original)
+++ team/file/logqueue/main/logger.c Mon Sep 4 22:37:32 2006
@@ -903,11 +903,16 @@
logmsg->line = line;
logmsg->function = function;
- /* Add it to the list at the tail end, and prod the logging thread */
- AST_LIST_LOCK(&logmsgs);
- AST_LIST_INSERT_TAIL(&logmsgs, logmsg, list);
- ast_cond_signal(&logcond);
- AST_LIST_UNLOCK(&logmsgs);
+ /* If the logger thread is active, append it to the tail end of the list - otherwise skip that step */
+ if (logthread != AST_PTHREADT_NULL) {
+ AST_LIST_LOCK(&logmsgs);
+ AST_LIST_INSERT_TAIL(&logmsgs, logmsg, list);
+ ast_cond_signal(&logcond);
+ AST_LIST_UNLOCK(&logmsgs);
+ } else {
+ logger_print_normal(logmsg);
+ free(logmsg);
+ }
return;
}
@@ -982,11 +987,16 @@
fmt = datefmt;
}
- /* Add to the list and poke the thread */
- AST_LIST_LOCK(&logmsgs);
- AST_LIST_INSERT_TAIL(&logmsgs, logmsg, list);
- ast_cond_signal(&logcond);
- AST_LIST_UNLOCK(&logmsgs);
+ /* Add to the list and poke the thread if possible */
+ if (logthread != AST_PTHREADT_NULL) {
+ AST_LIST_LOCK(&logmsgs);
+ AST_LIST_INSERT_TAIL(&logmsgs, logmsg, list);
+ ast_cond_signal(&logcond);
+ AST_LIST_UNLOCK(&logmsgs);
+ } else {
+ logger_print_verbose(logmsg);
+ free(logmsg);
+ }
}
int ast_register_verbose(void (*v)(const char *string))
More information about the asterisk-commits
mailing list