diff --git a/src/db/dbEvent.c b/src/db/dbEvent.c index 4103dbce8..e6a079a17 100644 --- a/src/db/dbEvent.c +++ b/src/db/dbEvent.c @@ -195,27 +195,11 @@ struct event_user *db_init_events(void) return NULL; evUser->firstque.evUser = evUser; - evUser->firstque.writelock = semMutexCreate(); - if (!evUser->firstque.writelock) { - freeListFree (dbevEventUserFreeList, evUser); - return NULL; - } - evUser->ppendsem = semBinaryCreate(semEmpty); - if(!evUser->ppendsem){ - semMutexDestroy(evUser->firstque.writelock); - freeListFree(dbevEventUserFreeList, evUser); - return NULL; - } - evUser->pflush_sem = semBinaryCreate(semEmpty); - if(!evUser->pflush_sem){ - semMutexDestroy(evUser->firstque.writelock); - semBinaryDestroy(evUser->ppendsem); - freeListFree(dbevEventUserFreeList, evUser); - return NULL; - } - evUser->flowCtrlMode = FALSE; - - return evUser; + evUser->firstque.writelock = semMutexCreate(); + evUser->ppendsem = semBinaryCreate(semEmpty); + evUser->pflush_sem = semBinaryCreate(semEmpty); + evUser->flowCtrlMode = FALSE; + return evUser; } @@ -864,10 +848,10 @@ LOCAL int event_read (struct event_que *ev_que) * suspend processing events until flow control * mode is over */ - if (ev_que->evUser->flowCtrlMode && ev_que->nDuplicates==0u) { + if (ev_que->evUser->flowCtrlMode && ev_que->nDuplicates==0u) { UNLOCKEVQUE(ev_que); - return OK; - } + return OK; + } /* * Fetch fast register copy @@ -896,7 +880,7 @@ LOCAL int event_read (struct event_que *ev_que) pfl = NULL; } - ev_que->evque[ev_que->getix] = EVENTQEMPTY; + ev_que->evque[ev_que->getix] = EVENTQEMPTY; /* * remove event from the queue diff --git a/src/db/dbEvent.h b/src/db/dbEvent.h index 9d546e73a..b823034e2 100644 --- a/src/db/dbEvent.h +++ b/src/db/dbEvent.h @@ -79,7 +79,7 @@ struct event_que{ unsigned short putix; unsigned short getix; unsigned short quota; /* the number of assigned entries*/ - unsigned short nDuplicates; /* N events duplicated on this q */ + unsigned short nDuplicates; /* N events duplicated on this q */ }; typedef void OVRFFUNC (void *overflow_arg, unsigned count); @@ -91,20 +91,20 @@ struct event_user { semId ppendsem; /* Wait while empty */ semId pflush_sem; /* wait for flush */ - OVRFFUNC *overflow_sub; /* called when overflow detect */ + OVRFFUNC *overflow_sub; /* called when overflow detect */ void *overflow_arg; /* parameter to above */ - EXTRALABORFUNC *extralabor_sub;/* off load to event task */ + EXTRALABORFUNC *extralabor_sub;/* off load to event task */ void *extralabor_arg;/* parameter to above */ threadId taskid; /* event handler task id */ - unsigned queovr; /* event que overflow count */ + unsigned queovr; /* event que overflow count */ char pendlck; /* Only one task can pend */ unsigned char pendexit; /* exit pend task */ - unsigned char extra_labor; /* if set call extra labor func */ - unsigned char flowCtrlMode; /* replace existing monitor */ - int (*init_func)(); - int init_func_arg; + unsigned char extra_labor; /* if set call extra labor func */ + unsigned char flowCtrlMode; /* replace existing monitor */ + int (*init_func)(); + threadId init_func_arg; }; int db_event_list(char *name);