/* * Reregister a timer entry. This function is responsible for moving * the current pointer in the timer list to the next element to be * processed.. */ void ooTimerReset (OOCTXT* pctxt, DList *pList, OOTimer* pTimer) { if (pTimer->reRegister) { dListFindAndRemove (pList, pTimer); ooTimerComputeExpireTime (pTimer); ooTimerInsertEntry (pctxt, pList, pTimer); } else ooTimerDelete (pctxt, pList, pTimer); }
void ooTimerFireExpired (OOCTXT* pctxt, DList *pList) { OOTimer* pTimer; while (pList->count > 0) { pTimer = (OOTimer*) pList->head->data; if (ooTimerExpired (pTimer)) { /* * Re-register before calling callback function in case it is * a long duration callback. */ if (pTimer->reRegister) ooTimerReset (pctxt, pList, pTimer); (*pTimer->timeoutCB)(pTimer->cbData); if (!pTimer->reRegister) { ooTimerDelete (pctxt, pList, pTimer); } } else break; } }