q5/timerlist.go
aozhiwei a3ab521064 1
2020-09-08 17:00:41 +08:00

45 lines
864 B
Go

package q5
type TimerList struct {
entry ListHead
attachEntry ListHead
timerType int8
milliSeconds int32
expires int64
timerFunc func (params *XParams)
timerAfterFunc func (params *XParams)
params XParams
}
func (this *TimerList) InitTimerList(
timer interface{},
timerType int8,
millSeconds int32,
timerFunc func (params *XParams)) {
this.timerType = timerType
this.milliSeconds = millSeconds
this.timerFunc = timerFunc
}
func (this *TimerList) Reset() {
if !this.entry.Empty() {
this.entry.DelInit()
}
if !this.attachEntry.Empty() {
this.attachEntry.DelInit()
}
this.timerFunc = nil
this.timerAfterFunc = nil
this.params.Reset()
}
func (this *TimerList) Init() {
this.entry.Init()
this.attachEntry.Init()
}
func (this *TimerList) SetTimerAfterFunc(timerAfterFunc func(*XParams)) {
this.timerAfterFunc = timerAfterFunc
}