RemoveTimer 删除一个定时器,根据定时器的ID
(tID uint32)
| 139 | |
| 140 | // RemoveTimer 删除一个定时器,根据定时器的ID |
| 141 | func (tw *TimeWheel) RemoveTimer(tID uint32) { |
| 142 | tw.Lock() |
| 143 | defer tw.Unlock() |
| 144 | |
| 145 | for i := 0; i < tw.scales; i++ { |
| 146 | if _, ok := tw.timerQueue[i][tID]; ok { |
| 147 | delete(tw.timerQueue[i], tID) |
| 148 | } |
| 149 | } |
| 150 | } |
| 151 | |
| 152 | // AddTimeWheel 给一个时间轮添加下层时间轮 比如给小时时间轮添加分钟时间轮,给分钟时间轮添加秒时间轮 |
| 153 | func (tw *TimeWheel) AddTimeWheel(next *TimeWheel) { |