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); } }
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); }