1
This commit is contained in:
parent
9e16bd764d
commit
e934b0c6ca
@ -34,6 +34,7 @@ func (this *ListHead) Replace(pnew *ListHead) {
|
|||||||
pnew.next = this.next
|
pnew.next = this.next
|
||||||
pnew.next.prev = pnew
|
pnew.next.prev = pnew
|
||||||
pnew.prev = this.prev
|
pnew.prev = this.prev
|
||||||
|
pnew.prev.next = pnew
|
||||||
pnew.data = this.data
|
pnew.data = this.data
|
||||||
}
|
}
|
||||||
|
|
||||||
|
15
timer.go
15
timer.go
@ -53,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() {
|
||||||
@ -151,6 +151,7 @@ func (this *Timer) AddDeadLineTimerEx(
|
|||||||
if install_func != nil {
|
if install_func != nil {
|
||||||
install_func(timerList, &timerList.params)
|
install_func(timerList, &timerList.params)
|
||||||
}
|
}
|
||||||
|
this.ModifyTimer(timerList, milli_seconds)
|
||||||
return timerList
|
return timerList
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,6 +175,7 @@ func (this *Timer) AddRepeatTimerEx(
|
|||||||
if install_func != nil {
|
if install_func != nil {
|
||||||
install_func(timerList, &timerList.params)
|
install_func(timerList, &timerList.params)
|
||||||
}
|
}
|
||||||
|
this.ModifyTimer(timerList, milli_seconds)
|
||||||
return timerList
|
return timerList
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -197,6 +199,7 @@ func (this *Timer) AddFixedTimerEx(
|
|||||||
if install_func != nil {
|
if install_func != nil {
|
||||||
install_func(timerList, &timerList.params)
|
install_func(timerList, &timerList.params)
|
||||||
}
|
}
|
||||||
|
this.ModifyTimer(timerList, milli_seconds)
|
||||||
return timerList
|
return timerList
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -279,16 +282,16 @@ func (this *Timer) internalAddTimer(timer_list *TimerList) {
|
|||||||
index = (uint32)(expires & TVR_MASK)
|
index = (uint32)(expires & TVR_MASK)
|
||||||
vec = &this.tv1[index]
|
vec = &this.tv1[index]
|
||||||
} else if idx < (1 << (TVR_BITS + TVN_BITS)) {
|
} 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]
|
vec = &this.tv2[index]
|
||||||
} else if idx < (1 << (TVR_BITS + 2 * TVN_BITS)) {
|
} 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]
|
vec = &this.tv3[index]
|
||||||
} else if idx < (1 << (TVR_BITS + 3 * TVN_BITS)) {
|
} 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]
|
vec = &this.tv4[index]
|
||||||
} else {
|
} 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 = &this.tv5[index]
|
||||||
}
|
}
|
||||||
vec.AddTail(&timer_list.entry)
|
vec.AddTail(&timer_list.entry)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user