summaryrefslogtreecommitdiffstats
path: root/syslogd.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-14 17:34:54 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-14 17:34:54 +0000
commit8d186b303650c1d942543e28fdf8cf28a451f438 (patch)
tree8cddcb4d3eca34f451c9c11edc23513eb51cb668 /syslogd.c
parent3a209d530568ddfb448d3b55e506022245e394b4 (diff)
downloadrsyslog-8d186b303650c1d942543e28fdf8cf28a451f438.tar.gz
rsyslog-8d186b303650c1d942543e28fdf8cf28a451f438.tar.xz
rsyslog-8d186b303650c1d942543e28fdf8cf28a451f438.zip
first rough version of input module thread termination
Diffstat (limited to 'syslogd.c')
-rw-r--r--syslogd.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/syslogd.c b/syslogd.c
index f93a05c2..a0e43587 100644
--- a/syslogd.c
+++ b/syslogd.c
@@ -3491,9 +3491,8 @@ static void doDie(int sig)
/* die() is called when the program shall end. This typically only occurs
- * during sigterm or during the initialization. If you search for places where
- * it is called, search for "die", not "die(", because the later will not find
- * setting of signal handlers! As die() is intended to shutdown rsyslogd, it is
+ * during sigterm or during the initialization.
+ * As die() is intended to shutdown rsyslogd, it is
* safe to call exit() here. Just make sure that die() itself is not called
* at inapropriate places. As a general rule of thumb, it is a bad idea to add
* any calls to die() in new code!
@@ -3514,6 +3513,9 @@ static void die(int sig)
logmsgInternal(LOG_SYSLOG|LOG_INFO, buf, ADDDATE);
}
+ /* close the inputs */
+ thrdTerminateAll(); /* TODO: inputs only, please */
+
/* Free ressources and close connections */
freeSelectors();
@@ -4275,6 +4277,8 @@ init(void)
eDfltHostnameCmpMode = HN_NO_COMP;
Forwarding = 0;
+dbgprintf("init()\n");
+ thrdTerminateAll(); /* stop all running threads - TODO: reconsider location! */
#ifdef SYSLOG_INET
if (restart) {
if (pAllowedSenders_UDP != NULL) {
@@ -6275,6 +6279,7 @@ int main(int argc, char **argv)
usage();
checkPermissions();
+ thrdInit();
if ( !(Debug || NoFork) )
{
@@ -6437,9 +6442,12 @@ dbgprintf("joined thrdMain\n");
dbgprintf("reaching die\n");
die(bFinished);
+
+ thrdExit();
return 0;
}
-/* vi:set ai:
+/*
+ * vi:set ai:
*/