package q5 type XTimerWp struct { timer *XTimerList } type XTimerAttacher struct { timer *XTimer timers ListHead } func (this *XTimerAttacher) ClearTimers() { this.timer.clearAttacher(this) } type XTimerList struct { destoryHandleList ListHead entry ListHead attachEntry ListHead timerType int8 expireTime int32 expires int64 cb TimerCb wp *XTimerWp } func (this *XTimerWp) Expired() bool { return this.timer == nil } func (this *XTimerList) initTimerList( timer interface{}, timerType int8, expireTime int32, cb TimerCb) { this.timerType = timerType this.expireTime = expireTime this.cb = cb } func (this *XTimerList) reset() { if !this.entry.Empty() { this.entry.DelInit() } if !this.attachEntry.Empty() { this.attachEntry.DelInit() } this.cb = nil } func (this *XTimerList) init() { this.entry.Init(this) this.attachEntry.Init(this) this.destoryHandleList.Init(nil) } func (this *XTimerList) Attach(timerAttacher *XTimerAttacher) { timerAttacher.timers.AddTail(&this.attachEntry) }