diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2005-10-25 08:52:48 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2005-10-25 08:52:48 +0000 |
commit | 950d7b6293b09c58f4a856ae66071efcd9ac1325 (patch) | |
tree | 93fd21acf6a3597e5faf554a8729b4bb2fd76065 /syslogd.c | |
parent | 7ec0b41357a8c5a73600ef4b6e74dbff41a1222d (diff) | |
download | rsyslog-950d7b6293b09c58f4a856ae66071efcd9ac1325.tar.gz rsyslog-950d7b6293b09c58f4a856ae66071efcd9ac1325.tar.xz rsyslog-950d7b6293b09c58f4a856ae66071efcd9ac1325.zip |
some minor cosmetic things (preparing for bsd tests)
Diffstat (limited to 'syslogd.c')
-rw-r--r-- | syslogd.c | 16 |
1 files changed, 8 insertions, 8 deletions
@@ -582,7 +582,7 @@ static rsCStrObj *pDfltProgNameCmp; /* this is the first approach to a queue, this time with static * memory. */ -#define QUEUESIZE 100 +#define QUEUESIZE 10000 typedef struct { void* buf[QUEUESIZE]; long head, tail; @@ -4071,9 +4071,6 @@ void queueAdd (msgQueue *q, void* in) q->tail = 0; if (q->tail == q->head) q->full = 1; - /* TODO: THE FOLLOWING LINE IS A TEST AID! Remove it! */ -// if(q->tail > 1) - /* syslogd will NOT work when the line above is present! */ q->empty = 0; return; @@ -4105,7 +4102,7 @@ static void *singleWorker(void *vParam) assert(fifo != NULL); - while(!bGlblDone) { + while(!bGlblDone || !fifo->empty) { pthread_mutex_lock(fifo->mut); while (fifo->empty && !bGlblDone) { dprintf ("singleWorker: queue EMPTY, waiting for next message.\n"); @@ -4113,19 +4110,22 @@ static void *singleWorker(void *vParam) } if(!fifo->empty) { /* dequeue element (still protected from mutex) */ - dprintf("Worker dequeues...\n"); queueDel(fifo, &pMsg); assert(pMsg != NULL); pthread_mutex_unlock(fifo->mut); pthread_cond_signal (fifo->notFull); /* do actual processing (the lengthy part, runs in parallel) */ - dprintf("worker is running\n"); + dprintf("Lone worker is running...\n"); processMsg(pMsg); - dprintf("calling destructMsg(), Ref %d\n", pMsg->iRefCount); MsgDestruct(pMsg); + /* If you need a delay for testing, here do a */ + /* sleep(1); */ } + if(debugging_on && bGlblDone && !fifo->empty) + dprintf("Worker does not yet terminate because it still has messages to process.\n"); } + dprintf("Worker thread terminates\n"); pthread_exit(0); } |