diff --git a/go.mod b/go.mod index 3716411..f195170 100644 --- a/go.mod +++ b/go.mod @@ -1 +1,3 @@ module q5 + +go 1.15 diff --git a/listhead.go b/listhead.go index af5c8a6..04248bd 100644 --- a/listhead.go +++ b/listhead.go @@ -34,6 +34,7 @@ func (this *ListHead) Replace(pnew *ListHead) { pnew.next = this.next pnew.next.prev = pnew pnew.prev = this.prev + pnew.prev.next = pnew pnew.data = this.data } diff --git a/timer.go b/timer.go index 0f3f4aa..4d6cc5d 100644 --- a/timer.go +++ b/timer.go @@ -53,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() { @@ -151,6 +151,7 @@ func (this *Timer) AddDeadLineTimerEx( if install_func != nil { install_func(timerList, &timerList.params) } + this.ModifyTimer(timerList, milli_seconds) return timerList } @@ -174,6 +175,7 @@ func (this *Timer) AddRepeatTimerEx( if install_func != nil { install_func(timerList, &timerList.params) } + this.ModifyTimer(timerList, milli_seconds) return timerList } @@ -197,6 +199,7 @@ func (this *Timer) AddFixedTimerEx( if install_func != nil { install_func(timerList, &timerList.params) } + this.ModifyTimer(timerList, milli_seconds) return timerList } @@ -279,16 +282,16 @@ func (this *Timer) internalAddTimer(timer_list *TimerList) { index = (uint32)(expires & TVR_MASK) vec = &this.tv1[index] } else if idx < (1 << (TVR_BITS + TVN_BITS)) { - index = (uint32)((expires >> TVR_BITS) & TVR_MASK) + index = (uint32)((expires >> TVR_BITS) & TVN_MASK) vec = &this.tv2[index] } else if idx < (1 << (TVR_BITS + 2 * TVN_BITS)) { - index = (uint32)((expires >> (TVR_BITS + 1 * TVN_BITS)) & TVR_MASK) + index = (uint32)((expires >> (TVR_BITS + 1 * TVN_BITS)) & TVN_MASK) vec = &this.tv3[index] } else if idx < (1 << (TVR_BITS + 3 * TVN_BITS)) { - index = (uint32)((expires >> (TVR_BITS + 2 * TVN_BITS)) & TVR_MASK) + index = (uint32)((expires >> (TVR_BITS + 2 * TVN_BITS)) & TVN_MASK) vec = &this.tv4[index] } else { - index = (uint32)((expires >> (TVR_BITS + 3 * TVN_BITS)) & TVR_MASK) + index = (uint32)((expires >> (TVR_BITS + 3 * TVN_BITS)) & TVN_MASK) vec = &this.tv5[index] } vec.AddTail(&timer_list.entry)