From 9e16bd764d0a4456049605b74f58de46e929f9d9 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Thu, 3 Sep 2020 20:25:00 +0800 Subject: [PATCH] 1 --- timer.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/timer.go b/timer.go index b14566a..0f3f4aa 100644 --- a/timer.go +++ b/timer.go @@ -30,7 +30,6 @@ type Timer struct { tv3 [TVN_SIZE]ListHead tv4 [TVN_SIZE]ListHead tv5 [TVN_SIZE]ListHead - cascadeList ListHead } func (this *Timer) Init( @@ -54,12 +53,12 @@ func (this *Timer) Init( this.getTickCount = getTickCount this.gcTime = gcTime this.cacheTimerNum = cacheTimerNum - this.AddRepeatTimer( + /*this.AddRepeatTimer( this.gcTime, func (params *XParams) { }, - this.gcTimerFunc) + this.gcTimerFunc)*/ } 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 { - tv[index].ReplaceInit(&this.cascadeList) + var cascadeList ListHead + tv[index].ReplaceInit(&cascadeList) - if !this.cascadeList.Empty() { - pos := this.cascadeList.next + if !cascadeList.Empty() { + pos := cascadeList.next next := pos.next - for pos != &this.cascadeList { + for pos != &cascadeList { this.internalAddTimer(pos.data.(*TimerList)) pos = next next = pos.next } } - this.cascadeList.Init() + cascadeList.Init() return index }