/* This routine can be called from interrupt context */ int callbackRequest(CALLBACK *pcallback) { int priority; int pushOK; cbQueueSet *mySet; if (!pcallback) { epicsInterruptContextMessage("callbackRequest: pcallback was NULL\n"); return S_db_notInit; } priority = pcallback->priority; if (priority < 0 || priority >= NUM_CALLBACK_PRIORITIES) { epicsInterruptContextMessage("callbackRequest: Bad priority\n"); return S_db_badChoice; } mySet = &callbackQueue[priority]; if (mySet->queueOverflow) return S_db_bufFull; pushOK = epicsRingPointerPush(mySet->queue, pcallback); if (!pushOK) { char msg[48] = "callbackRequest: "; strcat(msg, threadNamePrefix[priority]); strcat(msg, " ring buffer full\n"); epicsInterruptContextMessage(msg); mySet->queueOverflow = TRUE; return S_db_bufFull; } epicsEventSignal(mySet->semWakeUp); return 0; }
void scanOnce(struct dbCommon *precord) { static int newOverflow = TRUE; int lockKey; int pushOK; lockKey = epicsInterruptLock(); pushOK = epicsRingPointerPush(onceQ, precord); epicsInterruptUnlock(lockKey); if (!pushOK) { if (newOverflow) errlogPrintf("scanOnce: Ring buffer overflow\n"); newOverflow = FALSE; } else { newOverflow = TRUE; } epicsEventSignal(onceSem); }