MCPcopy Create free account
hub / github.com/Cyinx/einx / newTimerWheel

Function newTimerWheel

timer/timer_wheel.go:18–38  ·  view source on GitHub ↗
(ms_unit uint64, bit_size uint32, now uint64, p *timerPool)

Source from the content-addressed store, hash-verified

16}
17
18func 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
40func (this *timerWheel) tickIdxDelta(runTick uint64) uint8 {
41 idxDelta := runTick - this.baseTick

Callers 1

NewTimerManagerFunction · 0.85

Calls 1

newTimerListFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…