示例#1
0
 public bool Cancel(IOThreadTimer timer)
 {
     lock (this.ThisLock)
     {
         if (timer.index > 0)
         {
             IOThreadTimer.TimerGroup timerGroup = timer.timerGroup;
             IOThreadTimer.TimerQueue timerQueue = timerGroup.TimerQueue;
             timerQueue.DeleteTimer(timer);
             if (timerQueue.Count > 0)
             {
                 this.UpdateWaitableTimer(timerGroup);
             }
             else
             {
                 IOThreadTimer.TimerGroup otherTimerGroup = this.GetOtherTimerGroup(timerGroup);
                 if (otherTimerGroup.TimerQueue.Count == 0)
                 {
                     long now  = Ticks.Now;
                     long num2 = timerGroup.WaitableTimer.DueTime - now;
                     long num3 = otherTimerGroup.WaitableTimer.DueTime - now;
                     if ((num2 > 0x989680L) && (num3 > 0x989680L))
                     {
                         timerGroup.WaitableTimer.Set(Ticks.Add(now, 0x989680L));
                     }
                 }
             }
             return(true);
         }
         return(false);
     }
 }
示例#2
0
            public void Set(IOThreadTimer timer, long dueTime)
            {
                long num = dueTime - timer.dueTime;

                if (num < 0L)
                {
                    num = -num;
                }
                if (num > timer.maxSkew)
                {
                    lock (this.ThisLock)
                    {
                        IOThreadTimer.TimerGroup timerGroup = timer.timerGroup;
                        IOThreadTimer.TimerQueue timerQueue = timerGroup.TimerQueue;
                        if (timer.index > 0)
                        {
                            if (timerQueue.UpdateTimer(timer, dueTime))
                            {
                                this.UpdateWaitableTimer(timerGroup);
                            }
                        }
                        else if (timerQueue.InsertTimer(timer, dueTime))
                        {
                            this.UpdateWaitableTimer(timerGroup);
                            if (timerQueue.Count == 1)
                            {
                                this.EnsureWaitScheduled();
                            }
                        }
                    }
                }
            }
示例#3
0
 private void ReactivateWaitableTimer(IOThreadTimer.TimerGroup timerGroup)
 {
     IOThreadTimer.TimerQueue timerQueue = timerGroup.TimerQueue;
     if (timerQueue.Count > 0)
     {
         timerGroup.WaitableTimer.Set(timerQueue.MinTimer.dueTime);
     }
     else
     {
         timerGroup.WaitableTimer.Set(0x7fffffffffffffffL);
     }
 }
示例#4
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);
     }
 }
示例#5
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);
            }
示例#6
0
 public TimerGroup()
 {
     this.waitableTimer = new IOThreadTimer.WaitableTimer();
     this.waitableTimer.Set(0x7fffffffffffffffL);
     this.timerQueue = new IOThreadTimer.TimerQueue();
 }
示例#7
0
			public TimerGroup()
			{
				this.waitableTimer = new IOThreadTimer.WaitableTimer();
				this.waitableTimer.Set(0x7fffffffffffffffL);
				this.timerQueue = new IOThreadTimer.TimerQueue();
			}