summaryrefslogtreecommitdiffstats
path: root/tcpsrv.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-07-20 18:36:30 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-07-20 18:36:30 +0200
commit7d92de155c832e0a4af2cb3b65f7cef909b19f8d (patch)
tree9618456aad0bc3ed955a851174d29466c40a46a7 /tcpsrv.c
parent093179e9d366de9319b7ef11ebc57e4e8e789817 (diff)
downloadrsyslog-7d92de155c832e0a4af2cb3b65f7cef909b19f8d.tar.gz
rsyslog-7d92de155c832e0a4af2cb3b65f7cef909b19f8d.tar.xz
rsyslog-7d92de155c832e0a4af2cb3b65f7cef909b19f8d.zip
internal: added ability to terminate input modules not via pthread_cancel...
... but an alternate approach via pthread_kill. This is somewhat safer as we do not need to think about the cancel-safeness of all libraries we use. However, not all inputs can easily supported, so this now is a feature that can be requested by the input module (the most important ones request it).
Diffstat (limited to 'tcpsrv.c')
-rw-r--r--tcpsrv.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/tcpsrv.c b/tcpsrv.c
index 776dc46b..5c1a4ac8 100644
--- a/tcpsrv.c
+++ b/tcpsrv.c
@@ -549,6 +549,8 @@ Run(tcpsrv_t *pThis)
/* wait for io to become ready */
CHKiRet(nssel.Wait(pSel, &nfds));
+ if(glbl.GetGlobalInputTermState() == 1)
+ break; /* terminate input! */
for(i = 0 ; i < pThis->iLstnMax ; ++i) {
CHKiRet(nssel.IsReady(pSel, pThis->ppLstn[i], NSDSEL_RD, &bIsReady, &nfds));
@@ -580,7 +582,7 @@ finalize_it: /* this is a very special case - this time only we do not exit the
}
/* note that this point is usually not reached */
- pthread_cleanup_pop(0); /* remove cleanup handler */
+ pthread_cleanup_pop(1); /* remove cleanup handler */
RETiRet;
}