mirror of
https://github.com/rsyslog/rsyslog.git
synced 2026-08-30 15:10:18 +02:00
some minor cosmetic things (preparing for bsd tests)
This commit is contained in:
parent
7ec0b41357
commit
950d7b6293
16
syslogd.c
16
syslogd.c
@ -582,7 +582,7 @@ static rsCStrObj *pDfltProgNameCmp;
|
|||||||
/* this is the first approach to a queue, this time with static
|
/* this is the first approach to a queue, this time with static
|
||||||
* memory.
|
* memory.
|
||||||
*/
|
*/
|
||||||
#define QUEUESIZE 100
|
#define QUEUESIZE 10000
|
||||||
typedef struct {
|
typedef struct {
|
||||||
void* buf[QUEUESIZE];
|
void* buf[QUEUESIZE];
|
||||||
long head, tail;
|
long head, tail;
|
||||||
@ -4071,9 +4071,6 @@ void queueAdd (msgQueue *q, void* in)
|
|||||||
q->tail = 0;
|
q->tail = 0;
|
||||||
if (q->tail == q->head)
|
if (q->tail == q->head)
|
||||||
q->full = 1;
|
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;
|
q->empty = 0;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -4105,7 +4102,7 @@ static void *singleWorker(void *vParam)
|
|||||||
|
|
||||||
assert(fifo != NULL);
|
assert(fifo != NULL);
|
||||||
|
|
||||||
while(!bGlblDone) {
|
while(!bGlblDone || !fifo->empty) {
|
||||||
pthread_mutex_lock(fifo->mut);
|
pthread_mutex_lock(fifo->mut);
|
||||||
while (fifo->empty && !bGlblDone) {
|
while (fifo->empty && !bGlblDone) {
|
||||||
dprintf ("singleWorker: queue EMPTY, waiting for next message.\n");
|
dprintf ("singleWorker: queue EMPTY, waiting for next message.\n");
|
||||||
@ -4113,19 +4110,22 @@ static void *singleWorker(void *vParam)
|
|||||||
}
|
}
|
||||||
if(!fifo->empty) {
|
if(!fifo->empty) {
|
||||||
/* dequeue element (still protected from mutex) */
|
/* dequeue element (still protected from mutex) */
|
||||||
dprintf("Worker dequeues...\n");
|
|
||||||
queueDel(fifo, &pMsg);
|
queueDel(fifo, &pMsg);
|
||||||
assert(pMsg != NULL);
|
assert(pMsg != NULL);
|
||||||
pthread_mutex_unlock(fifo->mut);
|
pthread_mutex_unlock(fifo->mut);
|
||||||
pthread_cond_signal (fifo->notFull);
|
pthread_cond_signal (fifo->notFull);
|
||||||
/* do actual processing (the lengthy part, runs in parallel) */
|
/* do actual processing (the lengthy part, runs in parallel) */
|
||||||
dprintf("worker is running\n");
|
dprintf("Lone worker is running...\n");
|
||||||
processMsg(pMsg);
|
processMsg(pMsg);
|
||||||
dprintf("calling destructMsg(), Ref %d\n", pMsg->iRefCount);
|
|
||||||
MsgDestruct(pMsg);
|
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);
|
pthread_exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user