MCPcopy
hub / github.com/aceld/zinx / CreateTimerAt

Method CreateTimerAt

ztimer/timerscheduler.go:65–71  ·  view source on GitHub ↗

CreateTimerAt 创建一个定点Timer 并将Timer添加到分层时间轮中, 返回Timer的tID

(df *DelayFunc, unixNano int64)

Source from the content-addressed store, hash-verified

63
64// CreateTimerAt 创建一个定点Timer 并将Timer添加到分层时间轮中, 返回Timer的tID
65func (ts *TimerScheduler) CreateTimerAt(df *DelayFunc, unixNano int64) (uint32, error) {
66 ts.Lock()
67 defer ts.Unlock()
68
69 ts.IDGen++
70 return ts.IDGen, ts.tw.AddTimer(ts.IDGen, NewTimerAt(df, unixNano))
71}
72
73// CreateTimerAfter 创建一个延迟Timer 并将Timer添加到分层时间轮中, 返回Timer的tID
74func (ts *TimerScheduler) CreateTimerAfter(df *DelayFunc, duration time.Duration) (uint32, error) {

Callers

nothing calls this directly

Calls 2

NewTimerAtFunction · 0.85
AddTimerMethod · 0.80

Tested by

no test coverage detected