100 lines
2.2 KiB
Go
100 lines
2.2 KiB
Go
package f5
|
|
|
|
import (
|
|
"q5"
|
|
)
|
|
|
|
type TimerWp struct {
|
|
*q5.XTimerWp
|
|
}
|
|
|
|
type TimerAttacher struct {
|
|
*q5.XTimerAttacher
|
|
}
|
|
|
|
type timer struct {
|
|
base *q5.XTimer
|
|
}
|
|
|
|
func (this *timer) init() {
|
|
this.base = new(q5.XTimer)
|
|
this.base.Init(
|
|
func (context interface{}) int64 {
|
|
return q5.GetTickCount()
|
|
},
|
|
nil,
|
|
1000 * 60,
|
|
5000)
|
|
}
|
|
|
|
func (this *timer) update() {
|
|
this.base.Update()
|
|
}
|
|
|
|
func (this *timer) unInit() {
|
|
this.base.UnInit()
|
|
this.base = nil
|
|
}
|
|
|
|
func (this *timer) NewTimerAttacher() *TimerAttacher {
|
|
ac := TimerAttacher{}
|
|
ac.XTimerAttacher = this.base.NewTimerAttacher()
|
|
return &ac
|
|
}
|
|
|
|
func (this *timer) SetTimeout(expireTime int32, cb q5.TimerCb) {
|
|
this.base.SetTimeout(expireTime, cb)
|
|
}
|
|
|
|
func (this *timer) SetTimeoutEx(expireTime int32, cb q5.TimerCb, ac *TimerAttacher) {
|
|
this.base.SetTimeoutEx(expireTime, cb, ac.XTimerAttacher)
|
|
}
|
|
|
|
func (this *timer) SetTimeoutWp(expireTime int32, cb q5.TimerCb) *TimerWp {
|
|
wp := TimerWp{}
|
|
wp.XTimerWp = this.base.SetTimeoutWp(expireTime, cb)
|
|
return &wp
|
|
}
|
|
|
|
func (this *timer) SetTimeoutExWp(expireTime int32, cb q5.TimerCb, ac *TimerAttacher) *TimerWp {
|
|
wp := TimerWp{}
|
|
wp.XTimerWp = this.base.SetTimeoutExWp(expireTime, cb, ac.XTimerAttacher)
|
|
return &wp
|
|
}
|
|
|
|
func (this *timer) SetInterval(expireTime int32, cb q5.TimerCb) {
|
|
this.base.SetInterval(expireTime, cb)
|
|
}
|
|
|
|
func (this *timer) SetIntervalEx(expireTime int32, cb q5.TimerCb, ac *TimerAttacher) {
|
|
this.base.SetIntervalEx(expireTime, cb, ac.XTimerAttacher)
|
|
}
|
|
|
|
func (this *timer) SetIntervalWp(expireTime int32, cb q5.TimerCb) *TimerWp {
|
|
wp := TimerWp{}
|
|
wp.XTimerWp = this.base.SetIntervalWp(expireTime, cb)
|
|
return &wp
|
|
}
|
|
|
|
func (this *timer) SetIntervalExWp(expireTime int32, cb q5.TimerCb, ac *TimerAttacher) *TimerWp {
|
|
wp := TimerWp{}
|
|
wp.XTimerWp = this.base.SetIntervalExWp(expireTime, cb, ac.XTimerAttacher)
|
|
return &wp
|
|
}
|
|
|
|
func (this *timer) GetIdleTime() int64 {
|
|
return this.base.GetIdleTime()
|
|
}
|
|
|
|
func (this *timer) ModifyTimer(timerWp *TimerWp, expireTime int32) {
|
|
this.base.ModifyTimer(timerWp.XTimerWp, expireTime)
|
|
}
|
|
|
|
func (this *timer) Delete(timerWp *TimerWp) {
|
|
this.base.Delete(timerWp.XTimerWp)
|
|
}
|
|
|
|
func (this *timer) GetRemainTime(timerWp *TimerWp) int64 {
|
|
return this.base.GetRemainTime(timerWp.XTimerWp)
|
|
}
|