This commit is contained in:
aozhiwei 2020-09-08 15:28:10 +08:00
parent 7749a036a0
commit 7ab75e421e
2 changed files with 14 additions and 14 deletions

View File

@ -58,7 +58,7 @@ func ForceCreateDir(dir string) bool {
func TraverseArray(arrayPtr interface{}, callback func(data interface{})) {
array := reflect.ValueOf(arrayPtr).Elem()
for i := 0; i < array.Len(); i++ {
val := array.Index(i)
val := array.Index(i).Addr().Interface()
callback(val)
}
}

View File

@ -97,27 +97,27 @@ func (this *Timer) Update() {
var workList ListHead
this.tv1[index].ReplaceInit(&workList)
for !workList.Empty() {
timer_list := workList.FirstEntry().(*TimerList)
this.runningTimer = timer_list
if timer_list.timerFunc != nil {
timer_list.timerFunc(&timer_list.params)
timerList := workList.FirstEntry().(*TimerList)
this.runningTimer = timerList
if timerList.timerFunc != nil {
timerList.timerFunc(&timerList.params)
}
if timer_list.timerAfterFunc != nil {
timer_list.timerAfterFunc(&timer_list.params)
if timerList.timerAfterFunc != nil {
timerList.timerAfterFunc(&timerList.params)
}
if this.runningTimer != nil {
switch this.runningTimer.timerType {
case REPEAT_TIMER, FIXED_TIMER:
if timer_list.timerType == FIXED_TIMER {
timer_list.fixedTimierExecuteTimes++
if timerList.timerType == FIXED_TIMER {
timerList.fixedTimierExecuteTimes++
}
this.ModifyTimer(timer_list, timer_list.milliSeconds)
this.ModifyTimer(timerList, timerList.milliSeconds)
case DEADLINE_TIMER:
this.detachTimer(timer_list)
if timer_list.attachEntry.Empty() {
timer_list.attachEntry.DelInit()
this.detachTimer(timerList)
if timerList.attachEntry.Empty() {
timerList.attachEntry.DelInit()
}
this.addToFreeList(timer_list)
this.addToFreeList(timerList)
}
}
}