Esempio n. 1
0
/*
 * Handle a message that will start a timer.
 *
 * pTimerStartReq  the timer start request message.
 */
static void actionTimerStart (TimerStartReq *pTimerStartReq)
{
    Timer * pTimer;
    
    printDebug ("actionTimerStart: starting a timer of duration %d 10ths of a second (from port %d, id %d, expiryMsg.msgType 0x%08x).\n",
                pTimerStartReq->expiryDeciSeconds,
                pTimerStartReq->sourcePort,
                pTimerStartReq->id,
                pTimerStartReq->expiryMsg.msgType);

    /* Allocate a timer and fill the data in */
    pTimer = allocTimer (pTimerStartReq->expiryDeciSeconds, pTimerStartReq->sourcePort, pTimerStartReq->id, &(pTimerStartReq->expiryMsg));
    if (pTimer != PNULL)
    {
        printDebug ("actionTimerStart: allocated a timer at 0x%08x.\n", pTimer);
    }
    else
    {
        ASSERT_ALWAYS_STRING ("actionTimerStart: unable to allocate a timer.");        
    }    
}
Esempio n. 2
0
static sTimer *
newTimer (
  time_tClock		*clock,
  void			*data,
  void			(*exec)()
)
{
  sTimer		*tp = allocTimer();

  tp->data  = data;
  tp->exec  = exec;

  if (clock == NULL)
    tp->clock = now_clock;
  else {

    tp->clock = *clock;
    tp->wrapped = (*clock < now_clock);
  }

  return tp;
}