diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-14 13:55:32 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-01-14 13:55:32 +0000 |
commit | 1b4a1902031babbb3907cd0e73d86c1fa0da0a3d (patch) | |
tree | e457c8a73fdff0ecd36f055cf0c0b72dd9319126 /queue.c | |
parent | a53b019a4e9dea315ac750981f0f690a81b8f33f (diff) | |
download | rsyslog-1b4a1902031babbb3907cd0e73d86c1fa0da0a3d.tar.gz rsyslog-1b4a1902031babbb3907cd0e73d86c1fa0da0a3d.tar.xz rsyslog-1b4a1902031babbb3907cd0e73d86c1fa0da0a3d.zip |
optimized code
Diffstat (limited to 'queue.c')
-rw-r--r-- | queue.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -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; } |