This commit is contained in:
aozhiwei 2020-09-08 18:26:02 +08:00
parent e0ae331d17
commit 6fd253d455

View File

@ -119,6 +119,13 @@ func (this *Timer) Update() {
this.runningTimer = nil this.runningTimer = nil
} }
func (this *Timer) NewTimerAttacher() *TimerAttacher {
attacher := new(TimerAttacher)
attacher.timer = this
attacher.timers.Init()
return attacher
}
func (this *Timer) AddDeadLineTimer( func (this *Timer) AddDeadLineTimer(
milli_seconds int32, milli_seconds int32,
init_func func (params* XParams), init_func func (params* XParams),
@ -226,10 +233,6 @@ func (this *Timer) DeleteTimer(timerList *TimerList) {
this.addToFreeList(timerList) this.addToFreeList(timerList)
} }
func (this *Timer) GetTimerByAtttach(attachEntry *ListHead) *TimerList {
return nil
}
func (this *Timer) GetRemainTime(timerList *TimerList) int64 { func (this *Timer) GetRemainTime(timerList *TimerList) int64 {
if timerList == nil { if timerList == nil {
return 0 return 0
@ -246,8 +249,15 @@ func (this *Timer) GetRunningTimer() *TimerList {
return this.runningTimer return this.runningTimer
} }
func (this *Timer) GetIdleMilliSeconds() int64 { func (this *Timer) GetIdleTime() int64 {
return 0 var idleTime int64 = 1
for i := (this.timerTick & TVR_MASK); i < TVR_SIZE; i++ {
if !this.tv1[i].Empty() {
break
}
idleTime++
}
return idleTime
} }
func (this *Timer) detachTimer(timerList *TimerList) { func (this *Timer) detachTimer(timerList *TimerList) {