This commit is contained in:
aozhiwei 2020-09-03 20:25:00 +08:00
parent 4192dcc9fc
commit 9e16bd764d

View File

@ -30,7 +30,6 @@ type Timer struct {
tv3 [TVN_SIZE]ListHead tv3 [TVN_SIZE]ListHead
tv4 [TVN_SIZE]ListHead tv4 [TVN_SIZE]ListHead
tv5 [TVN_SIZE]ListHead tv5 [TVN_SIZE]ListHead
cascadeList ListHead
} }
func (this *Timer) Init( func (this *Timer) Init(
@ -54,12 +53,12 @@ func (this *Timer) Init(
this.getTickCount = getTickCount this.getTickCount = getTickCount
this.gcTime = gcTime this.gcTime = gcTime
this.cacheTimerNum = cacheTimerNum this.cacheTimerNum = cacheTimerNum
this.AddRepeatTimer( /*this.AddRepeatTimer(
this.gcTime, this.gcTime,
func (params *XParams) { func (params *XParams) {
}, },
this.gcTimerFunc) this.gcTimerFunc)*/
} }
func (this *Timer) UnInit() { func (this *Timer) UnInit() {
@ -251,18 +250,19 @@ func (this *Timer) addToFreeList(timerList *TimerList) {
} }
func (this *Timer) cascade(tv *[TVN_SIZE]ListHead, index uint32) uint32 { func (this *Timer) cascade(tv *[TVN_SIZE]ListHead, index uint32) uint32 {
tv[index].ReplaceInit(&this.cascadeList) var cascadeList ListHead
tv[index].ReplaceInit(&cascadeList)
if !this.cascadeList.Empty() { if !cascadeList.Empty() {
pos := this.cascadeList.next pos := cascadeList.next
next := pos.next next := pos.next
for pos != &this.cascadeList { for pos != &cascadeList {
this.internalAddTimer(pos.data.(*TimerList)) this.internalAddTimer(pos.data.(*TimerList))
pos = next pos = next
next = pos.next next = pos.next
} }
} }
this.cascadeList.Init() cascadeList.Init()
return index return index
} }