Exemplo n.º 1
0
 private void ScheduleElapsedTimers(IOThreadTimer.TimerGroup timerGroup, long now)
 {
     IOThreadTimer.TimerQueue timerQueue = timerGroup.TimerQueue;
     while (timerQueue.Count > 0)
     {
         IOThreadTimer minTimer = timerQueue.MinTimer;
         long          num      = minTimer.dueTime - now;
         if (num > minTimer.maxSkew)
         {
             break;
         }
         timerQueue.DeleteMinTimer();
         ActionItem.Schedule(minTimer.callback, minTimer.callbackState);
     }
 }
Exemplo n.º 2
0
            public bool Cancel(IOThreadTimer timer)
            {
                bool flag;

                lock (this.ThisLock)
                {
                    if (timer.index <= 0)
                    {
                        flag = false;
                    }
                    else
                    {
                        IOThreadTimer.TimerGroup timerGroup = timer.timerGroup;
                        IOThreadTimer.TimerQueue timerQueue = timerGroup.TimerQueue;
                        timerQueue.DeleteTimer(timer);
                        if (timerQueue.Count <= 0)
                        {
                            IOThreadTimer.TimerGroup otherTimerGroup = this.GetOtherTimerGroup(timerGroup);
                            if (otherTimerGroup.TimerQueue.Count == 0)
                            {
                                long now     = Ticks.Now;
                                long dueTime = timerGroup.WaitableTimer.DueTime - now;
                                long num     = otherTimerGroup.WaitableTimer.DueTime - now;
                                if (dueTime > (long)0x989680 && num > (long)0x989680)
                                {
                                    timerGroup.WaitableTimer.Set(Ticks.Add(now, (long)0x989680));
                                }
                            }
                        }
                        else
                        {
                            this.UpdateWaitableTimer(timerGroup);
                        }
                        flag = true;
                    }
                }
                return(flag);
            }
Exemplo n.º 3
0
			public TimerManager()
			{
				this.onWaitCallback = new Action<object>(this.OnWaitCallback);
				this.stableTimerGroup = new IOThreadTimer.TimerGroup();
				this.volatileTimerGroup = new IOThreadTimer.TimerGroup();
				IOThreadTimer.WaitableTimer[] waitableTimer = new IOThreadTimer.WaitableTimer[2];
				waitableTimer[0] = this.stableTimerGroup.WaitableTimer;
				waitableTimer[1] = this.volatileTimerGroup.WaitableTimer;
				this.waitableTimers = waitableTimer;
			}
 public TimerManager()
 {
     this.onWaitCallback = new Action<object>(this.OnWaitCallback);
     this.stableTimerGroup = new IOThreadTimer.TimerGroup();
     this.volatileTimerGroup = new IOThreadTimer.TimerGroup();
     this.waitableTimers = new IOThreadTimer.WaitableTimer[] { this.stableTimerGroup.WaitableTimer, this.volatileTimerGroup.WaitableTimer };
 }