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{})) { func TraverseArray(arrayPtr interface{}, callback func(data interface{})) {
array := reflect.ValueOf(arrayPtr).Elem() array := reflect.ValueOf(arrayPtr).Elem()
for i := 0; i < array.Len(); i++ { for i := 0; i < array.Len(); i++ {
val := array.Index(i) val := array.Index(i).Addr().Interface()
callback(val) callback(val)
} }
} }

View File

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