예제 #1
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)10000000 && num > (long)10000000)
                                {
                                    timerGroup.WaitableTimer.Set(Ticks.Add(now, (long)10000000));
                                }
                            }
                        }
                        else
                        {
                            IOThreadTimer.TimerManager.UpdateWaitableTimer(timerGroup);
                        }
                        flag = true;
                    }
                }
                return(flag);
            }