summaryrefslogtreecommitdiffstats
path: root/runtime/stream.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-23 15:17:55 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-23 15:17:55 +0200
commitb1f2e53921b7ab19c363a63de47a0e7a35866052 (patch)
tree6b87e6a2a868482e16b64a6244e37512ebe4d4ab /runtime/stream.c
parentb50d13a6a97c0b6fa14807775ae0edf52ef015fb (diff)
downloadrsyslog-b1f2e53921b7ab19c363a63de47a0e7a35866052.tar.gz
rsyslog-b1f2e53921b7ab19c363a63de47a0e7a35866052.tar.xz
rsyslog-b1f2e53921b7ab19c363a63de47a0e7a35866052.zip
prevented unneccessary apc calls
Diffstat (limited to 'runtime/stream.c')
-rw-r--r--runtime/stream.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/runtime/stream.c b/runtime/stream.c
index f9859617..00c726d9 100644
--- a/runtime/stream.c
+++ b/runtime/stream.c
@@ -74,6 +74,7 @@ flushApc(void *param1, void __attribute__((unused)) *param2)
BEGIN_MTX_PROTECTED_OPERATIONS_UNCOND(&pThis->mut);
strmFlush(pThis);
+ pThis->apcRequested = 0;
END_MTX_PROTECTED_OPERATIONS_UNCOND(&pThis->mut);
}
@@ -1001,12 +1002,16 @@ scheduleFlushRequest(strm_t *pThis)
apc_t *pApc;
DEFiRet;
- CHKiRet(apc.CancelApc(pThis->apcID));
+ if(!pThis->apcRequested) {
+ /* we do an request only if none is yet pending */
+ pThis->apcRequested = 1;
+ // TODO: find similar thing later CHKiRet(apc.CancelApc(pThis->apcID));
dbgprintf("XXX: requesting to add apc!\n");
- CHKiRet(apc.Construct(&pApc));
- CHKiRet(apc.SetProcedure(pApc, (void (*)(void*, void*))flushApc));
- CHKiRet(apc.SetParam1(pApc, pThis));
- CHKiRet(apc.ConstructFinalize(pApc, &pThis->apcID));
+ CHKiRet(apc.Construct(&pApc));
+ CHKiRet(apc.SetProcedure(pApc, (void (*)(void*, void*))flushApc));
+ CHKiRet(apc.SetParam1(pApc, pThis));
+ CHKiRet(apc.ConstructFinalize(pApc, &pThis->apcID));
+ }
finalize_it:
RETiRet;