コード例 #1
0
ファイル: IOThreadTimer.cs プロジェクト: modulexcite/pash-1
 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);
     }
 }
コード例 #2
0
ファイル: IOThreadTimer.cs プロジェクト: modulexcite/pash-1
            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);
            }
コード例 #3
0
ファイル: IOThreadTimer.cs プロジェクト: nickchal/pash
			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;
			}
コード例 #4
0
 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 };
 }