mirror of
https://github.com/duanhf2012/origin.git
synced 2026-02-16 09:08:18 +08:00
新增定时器重新开启功能
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user