summaryrefslogtreecommitdiffstats
path: root/queue.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-01-14 13:55:32 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-01-14 13:55:32 +0000
commit1b4a1902031babbb3907cd0e73d86c1fa0da0a3d (patch)
treee457c8a73fdff0ecd36f055cf0c0b72dd9319126 /queue.c
parenta53b019a4e9dea315ac750981f0f690a81b8f33f (diff)
downloadrsyslog-1b4a1902031babbb3907cd0e73d86c1fa0da0a3d.tar.gz
rsyslog-1b4a1902031babbb3907cd0e73d86c1fa0da0a3d.tar.xz
rsyslog-1b4a1902031babbb3907cd0e73d86c1fa0da0a3d.zip
optimized code
Diffstat (limited to 'queue.c')
-rw-r--r--queue.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/queue.c b/queue.c
index b9e6471f..8010a45d 100644
--- a/queue.c
+++ b/queue.c
@@ -1060,9 +1060,10 @@ queueEnqObj(queue_t *pThis, void *pUsr)
* thread is canceled (most important use case is input module termination).
* rgerhards, 2008-01-08
*/
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
- if(pThis->pWrkThrds != NULL)
+ if(pThis->pWrkThrds != NULL) {
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &iCancelStateSave);
pthread_mutex_lock(pThis->mut);
+ }
while(pThis->iQueueSize >= pThis->iMaxQueueSize) {
dbgprintf("Queue 0x%lx: enqueueMsg: queue FULL - waiting to drain.\n", (unsigned long) pThis);
@@ -1083,9 +1084,9 @@ finalize_it:
pthread_mutex_unlock(pThis->mut);
i = pthread_cond_signal(pThis->notEmpty);
dbgprintf("Queue 0x%lx: EnqueueMsg signaled condition (%d)\n", (unsigned long) pThis, i);
+ pthread_setcancelstate(iCancelStateSave, NULL);
}
- pthread_setcancelstate(iCancelStateSave, NULL);
return iRet;
}