From c2631cdc8ae3509d1f011f33528ac5296b493dfe Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Wed, 1 Oct 2014 18:35:42 -0400 Subject: [PATCH] callback: don't track busy workers wakeup unconditionally. Perhaps inefficient, but simple. --- src/ioc/db/callback.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/ioc/db/callback.c b/src/ioc/db/callback.c index 76fb154b7..c37e1cc0f 100644 --- a/src/ioc/db/callback.c +++ b/src/ioc/db/callback.c @@ -55,7 +55,6 @@ typedef struct cbQueueSet { int queueOverflow; int threadsConfigured; int threadsRunning; - int threadsBusy; } cbQueueSet; static cbQueueSet callbackQueue[NUM_CALLBACK_PRIORITIES]; @@ -154,13 +153,11 @@ static void callbackTask(void *arg) taskwdInsert(0, NULL, NULL); epicsEventSignal(startStopEvent); - epicsAtomicIncrIntT(&mySet->threadsBusy); while(TRUE) { void *ptr; - epicsAtomicDecrIntT(&mySet->threadsBusy); if (epicsRingPointerIsEmpty(mySet->queue)) epicsEventMustWait(mySet->semWakeUp); - epicsAtomicIncrIntT(&mySet->threadsBusy); + while ((ptr = epicsRingPointerPop(mySet->queue))) { CALLBACK *pcallback = (CALLBACK *)ptr; if (ptr == &exitCallback) goto shutdown; @@ -250,7 +247,6 @@ int callbackRequest(CALLBACK *pcallback) { int priority; int pushOK; - int threadsBusy; cbQueueSet *mySet; if (!pcallback) { @@ -276,11 +272,7 @@ int callbackRequest(CALLBACK *pcallback) mySet->queueOverflow = TRUE; return S_db_bufFull; } - /* Wake up another sleeping thread, if threads are sleeping */ - threadsBusy = epicsAtomicGetIntT(&mySet->threadsBusy); - if (threadsBusy < mySet->threadsRunning) { - epicsEventSignal(mySet->semWakeUp); - } + epicsEventSignal(mySet->semWakeUp); return 0; }