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

Method AddTimer

timer/timer_manager.go:58–82  ·  view source on GitHub ↗
(delay uint64, op TimerHandler, args ...interface{})

Source from the content-addressed store, hash-verified

56}
57
58func (this *TimerManager) AddTimer(delay uint64, op TimerHandler, args ...interface{}) uint64 {
59 seqID := this.GetSeqID()
60
61 if delay < 0 {
62 delay = 0
63 }
64
65 run_tick := UnixTS() + delay
66
67 if run_tick > 0x000000ffffffffff {
68 run_tick = run_tick & 0x000000ffffffffff
69 }
70
71 xtimer := this.pool.Get()
72 xtimer.args = args
73 xtimer.handler = op
74 xtimer.next = nil
75 xtimer.running = false
76 xtimer.seqID = seqID
77 xtimer.runTick = run_tick
78
79 this.timer_wheels[4].add_timer(xtimer)
80
81 return xtimer.get_timer_id()
82}
83
84func (this *TimerManager) DeleteTimer(timerID uint64) bool {
85 if timerID == 0 {

Callers

nothing calls this directly

Calls 5

GetSeqIDMethod · 0.95
UnixTSFunction · 0.85
get_timer_idMethod · 0.80
GetMethod · 0.65
add_timerMethod · 0.45

Tested by

no test coverage detected