MCPcopy
hub / github.com/davyxu/cellnet / NewLoop

Function NewLoop

timer/loop.go:109–119  ·  view source on GitHub ↗

执行一个循环, 持续调用callback, 周期是duration context: 将context上下文传递到带有context指针的函数回调中

(q cellnet.EventQueue, duration time.Duration, notifyCallback func(*Loop), context interface{})

Source from the content-addressed store, hash-verified

107// 执行一个循环, 持续调用callback, 周期是duration
108// context: 将context上下文传递到带有context指针的函数回调中
109func NewLoop(q cellnet.EventQueue, duration time.Duration, notifyCallback func(*Loop), context interface{}) *Loop {
110
111 self := &Loop{
112 Context: context,
113 Duration: duration,
114 notifyCallback: notifyCallback,
115 Queue: q,
116 }
117
118 return self
119}

Callers 2

TestLoopTimerFunction · 0.92
TestLoopPanicFunction · 0.85

Calls

no outgoing calls

Tested by 2

TestLoopTimerFunction · 0.74
TestLoopPanicFunction · 0.68