From 8d186b303650c1d942543e28fdf8cf28a451f438 Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Fri, 14 Dec 2007 17:34:54 +0000 Subject: first rough version of input module thread termination --- syslogd.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'syslogd.c') 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: */ -- cgit