summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-16 09:42:36 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-16 09:42:36 +0200
commite005c5569c3e0c7c9a098036b7ec3596c3c722b4 (patch)
tree3a130a168de2e9b3aa3cc4c8a4eb46d4cc62e35a
parentd9f1a16de4723f9e096fa9abe47e8a845c815df0 (diff)
downloadrsyslog-e005c5569c3e0c7c9a098036b7ec3596c3c722b4.tar.gz
rsyslog-e005c5569c3e0c7c9a098036b7ec3596c3c722b4.tar.xz
rsyslog-e005c5569c3e0c7c9a098036b7ec3596c3c722b4.zip
some minor cleanup, consolidated some code
-rw-r--r--plugins/immark/immark.c10
-rw-r--r--threads.c24
-rw-r--r--threads.h1
3 files changed, 2 insertions, 33 deletions
diff --git a/plugins/immark/immark.c b/plugins/immark/immark.c
index 19f43456..5d48369e 100644
--- a/plugins/immark/immark.c
+++ b/plugins/immark/immark.c
@@ -42,6 +42,7 @@
#include "module-template.h"
#include "errmsg.h"
#include "msg.h"
+#include "srUtils.h"
#include "glbl.h"
MODULE_TYPE_INPUT
@@ -80,20 +81,13 @@ CODESTARTrunInput
* 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, iMarkMessagePeriod, 0)); /* seconds, micro seconds */
+ srSleep(iMarkMessagePeriod, 0); /* seconds, micro seconds */
if(glbl.GetGlobalInputTermState() == 1)
break; /* terminate input! */
logmsgInternal(NO_ERRCODE, LOG_INFO, (uchar*)"-- MARK --", MARK);
}
-finalize_it:
- return iRet;
ENDrunInput
diff --git a/threads.c b/threads.c
index b8c19ed2..ccc80816 100644
--- a/threads.c
+++ b/threads.c
@@ -250,29 +250,5 @@ rsRetVal thrdExit(void)
}
-/* thrdSleep() - a fairly portable way to put a thread to sleep. It
- * will wake up when
- * a) the wake-time is over
- * b) the thread shall be terminated
- * Returns RS_RET_OK if all went well, RS_RET_TERMINATE_NOW if the calling
- * thread shall be terminated and any other state if an error happened.
- * rgerhards, 2007-12-17
- */
-rsRetVal
-thrdSleep(thrdInfo_t *pThis, int iSeconds, int iuSeconds)
-{
- DEFiRet;
- struct timeval tvSelectTimeout;
-
- assert(pThis != NULL);
- tvSelectTimeout.tv_sec = iSeconds;
- tvSelectTimeout.tv_usec = iuSeconds; /* micro seconds */
- select(1, NULL, NULL, NULL, &tvSelectTimeout);
- if(pThis->bShallStop)
- iRet = RS_RET_TERMINATE_NOW;
- RETiRet;
-}
-
-
/* vi:set ai:
*/
diff --git a/threads.h b/threads.h
index 643f0107..1cac02b5 100644
--- a/threads.h
+++ b/threads.h
@@ -41,7 +41,6 @@ rsRetVal thrdInit(void);
rsRetVal thrdTerminate(thrdInfo_t *pThis);
rsRetVal thrdTerminateAll(void);
rsRetVal thrdCreate(rsRetVal (*thrdMain)(thrdInfo_t*), rsRetVal(*afterRun)(thrdInfo_t *), bool);
-rsRetVal thrdSleep(thrdInfo_t *pThis, int iSeconds, int iuSeconds);
/* macros (replace inline functions) */