/// <summary>
 /// Remove this timer event from the processor
 /// </summary>
 /// <param name="fsmTimerEvent">timer event to remove</param>
 public void RemoveTimerEvent( FsmTimerEvent fsmTimerEvent )
 {
     lock(this)
     {
         timerList.Remove(fsmTimerEvent);
         timerList.Insert(0,fsmTimerEvent );
         timerListChanged = true;
         Monitor.Pulse(this);
     }
 }
Exemple #2
0
 /// <summary>
 /// Send a timer event to this FSM. The event will be forwarded to the processor.
 /// It is not called directly but in the context of the processor thread.
 /// </summary>
 /// <param name="ev"></param>
 public void PushEvent( FsmTimerEvent ev )
 {
     FsmProcessor.PushEvent( ev, this );
 }
 /// <summary>
 /// Push timer event on an FSM using this processor 
 /// </summary>
 /// <param name="fsmTimerEvent">timer event to push</param>
 /// <param name="fsm">target FSM</param>
 public void PushEvent( FsmTimerEvent fsmTimerEvent, Fsm fsm )
 {
     lock(this)
     {
         fsmTimerEvent.Fsm = fsm;
         bool inserted = false;
         for (int i = 0; i < timerList.Count; i++)
         {
             if (((FsmTimerEvent)timerList[i]).ExpiryTime >= fsmTimerEvent.ExpiryTime)
             {
                 timerList.Insert(i,fsmTimerEvent);
                 inserted = true;
                 break;
             }
         }
         if (!inserted)
         {
             timerList.Add(fsmTimerEvent);
         }
         timerListChanged = true;
         Monitor.Pulse(this);
     }
 }