1
This commit is contained in:
parent
e934b0c6ca
commit
a9b6ae14e7
@ -48,4 +48,6 @@ func (this *ListHead) Empty() bool {
|
||||
}
|
||||
|
||||
func (this *ListHead) DelInit() {
|
||||
this.Del()
|
||||
this.Init()
|
||||
}
|
||||
|
13
timer.go
13
timer.go
@ -92,10 +92,10 @@ func (this *Timer) Update() {
|
||||
index := uint32(this.timerTick & TVR_MASK)
|
||||
|
||||
if index != 0 &&
|
||||
this.cascade(&this.tv2, this.getTimerIndex(index)) != 0 &&
|
||||
this.cascade(&this.tv3, this.getTimerIndex(index)) != 0 &&
|
||||
this.cascade(&this.tv4, this.getTimerIndex(index)) != 0 {
|
||||
this.cascade(&this.tv5, this.getTimerIndex(index))
|
||||
this.cascade(&this.tv2, this.getTimerIndex(0)) != 0 &&
|
||||
this.cascade(&this.tv3, this.getTimerIndex(1)) != 0 &&
|
||||
this.cascade(&this.tv4, this.getTimerIndex(2)) != 0 {
|
||||
this.cascade(&this.tv5, this.getTimerIndex(3))
|
||||
}
|
||||
this.timerTick += 1
|
||||
|
||||
@ -270,6 +270,7 @@ func (this *Timer) cascade(tv *[TVN_SIZE]ListHead, index uint32) uint32 {
|
||||
}
|
||||
|
||||
func (this *Timer) internalAddTimer(timer_list *TimerList) {
|
||||
timer_list.entry.data = timer_list
|
||||
expires := timer_list.expires
|
||||
idx := expires - this.timerTick
|
||||
var vec *ListHead
|
||||
@ -308,7 +309,9 @@ func (this *Timer) newTimerList() *TimerList {
|
||||
this.freeTimerNum -= 1
|
||||
return timerList
|
||||
} else {
|
||||
return new(TimerList)
|
||||
timerList := new(TimerList)
|
||||
timerList.entry.Init()
|
||||
return timerList
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user