(ms_unit uint64, bit_size uint32, now uint64, p *timerPool)
| 16 | } |
| 17 | |
| 18 | func newTimerWheel(ms_unit uint64, bit_size uint32, now uint64, p *timerPool) *timerWheel { |
| 19 | timer_wheel := &timerWheel{ |
| 20 | index: 0, |
| 21 | bitSize: bit_size, |
| 22 | msUnit: ms_unit, |
| 23 | next_wheel: nil, |
| 24 | prev_wheel: nil, |
| 25 | } |
| 26 | |
| 27 | if ms_unit == 1 { |
| 28 | timer_wheel.baseTick = now |
| 29 | } else { |
| 30 | timer_wheel.baseTick = now + ms_unit |
| 31 | } |
| 32 | |
| 33 | for i := 0; i < TIMERSLOTSCOUNT; i++ { |
| 34 | timer_wheel.array[i] = newTimerList(p) |
| 35 | } |
| 36 | |
| 37 | return timer_wheel |
| 38 | } |
| 39 | |
| 40 | func (this *timerWheel) tickIdxDelta(runTick uint64) uint8 { |
| 41 | idxDelta := runTick - this.baseTick |
no test coverage detected
searching dependent graphs…