summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-12-17 09:06:23 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-12-17 09:06:23 +0000
commit18dbfe70d804f6436658e8dd0af79188333e165a (patch)
tree5a89356fbad257f65a5ab8ed3bf8a77b84096678 /plugins
parent0a8e339bfeeb65bbd52264fab68cc13dd99d50e7 (diff)
downloadrsyslog-18dbfe70d804f6436658e8dd0af79188333e165a.tar.gz
rsyslog-18dbfe70d804f6436658e8dd0af79188333e165a.tar.xz
rsyslog-18dbfe70d804f6436658e8dd0af79188333e165a.zip
moved thread termination code out to threads.c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/immark/immark.c30
1 files changed, 13 insertions, 17 deletions
diff --git a/plugins/immark/immark.c b/plugins/immark/immark.c
index 4145faf6..72750e65 100644
--- a/plugins/immark/immark.c
+++ b/plugins/immark/immark.c
@@ -67,26 +67,22 @@ typedef struct _instanceData {
*/
BEGINrunInput
CODESTARTrunInput
- struct timeval tvSelectTimeout;
- sigset_t sigSet;
- sigfillset(&sigSet);
- pthread_sigmask(SIG_BLOCK, &sigSet, NULL);
- sigemptyset(&sigSet);
- sigaddset(&sigSet, SIGUSR2);
- pthread_sigmask(SIG_UNBLOCK, &sigSet, NULL);
- while(!bFinished) {
-dbgprintf("immark pre select\n");
- tvSelectTimeout.tv_sec = 5;
- tvSelectTimeout.tv_usec = 0;
- select(0, NULL, NULL, NULL, &tvSelectTimeout);
- if(bFinished)
- break;
-dbgprintf("immark post select, doing mark, bFinished: %d\n", bFinished);
+ /* this is an endless loop - it is terminated when the thread is
+ * signalled to do so. This, however, is handled by the framework,
+ * right into the sleep below.
+ */
+ while(1) {
+ /* we do not need to handle the RS_RET_TERMINATE_NOW case any
+ * special because we just need to terminate. This may be different
+ * if a cleanup is needed. But for now, we can just use CHKiRet().
+ * rgerhards, 2007-12-17
+ */
+ CHKiRet(thrdSleep(pThrd, 5, 0)); /* seconds, micro seconds */
logmsgInternal(LOG_INFO, "-- MARK --", ADDDATE);
//logmsgInternal(LOG_INFO, "-- MARK --", ADDDATE|MARK);
}
-dbgprintf("immark: finished!\n");
- return RS_RET_OK;
+finalize_it:
+ return iRet;
ENDrunInput