/* ... put a timer on the pending list (start it) */ void radTimerStart ( TIMER_ID timer, ULONG time ) { if (timer == NULL) return; radUtilsDisableSignal (SIGALRM); // only update the delta times and lastTick before adding the new one serviceTimers (FALSE); timer->deltaTime = time; if (timer->pending == FALSE) { // add to pending list timer->pending = TRUE; radListAddToEnd (&timerList->pendingList, (NODE_PTR)timer); } // process timers right here to avoid race conditions, then restart signal radUtilsSetIntervalTimer (serviceTimers (TRUE)); radUtilsEnableSignal (SIGALRM); return; }
static void timerSignalHandler (int signum) { // process the timer list here and restart based on the return value radUtilsSetIntervalTimer (serviceTimers (TRUE)); return; }
void radTimerSetUserParm ( TIMER_ID timer, void *newParm ) { if (timer == NULL) return; radUtilsDisableSignal (SIGALRM); timer->parm = newParm; // process timers right here to avoid race conditions, then restart signal radUtilsSetIntervalTimer (serviceTimers (TRUE)); radUtilsEnableSignal (SIGALRM); return; }
void radTimerStop ( TIMER_ID timer ) { if (timer == NULL) return; radUtilsDisableSignal (SIGALRM); if (timer->pending == TRUE) { timer->pending = FALSE; radListRemove (&timerList->pendingList, (NODE_PTR)timer); } // process timers right here to avoid race conditions, then restart signal radUtilsSetIntervalTimer (serviceTimers (TRUE)); radUtilsEnableSignal (SIGALRM); }
int HelloProcessTimeout(void) { serviceTimers(&hcp->Mtimer); return(0); }