新增定时器重新开启功能

This commit is contained in:
boyce
2020-12-16 16:12:59 +08:00
parent 1eeffb2d05
commit bcd1e9969d
2 changed files with 21 additions and 6 deletions

View File

@@ -8,6 +8,11 @@ import (
)
func SetupTimer(timer *Timer) *Timer{
if timer.rOpen == true {
return nil
}
timer.rOpen = true
timerHeapLock.Lock() // 使用锁规避竞争条件
heap.Push(&timerHeap,timer)
timerHeapLock.Unlock()
@@ -94,7 +99,7 @@ func tick() bool{
return true
}
t.rOpen = false
t.C <- t
return true
}