执行一个循环, 持续调用callback, 周期是duration context: 将context上下文传递到带有context指针的函数回调中
(q cellnet.EventQueue, duration time.Duration, notifyCallback func(*Loop), context interface{})
| 107 | // 执行一个循环, 持续调用callback, 周期是duration |
| 108 | // context: 将context上下文传递到带有context指针的函数回调中 |
| 109 | func 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 | } |
no outgoing calls