github.com/geniusesgroup/libgo@v0.0.0-20220713101832-828057a9d3d4/timer/timers-heap.go (about) 1 //go:build !time-wheel 2 3 /* For license and copyright information please see LEGAL file in repository */ 4 5 package timer 6 7 import ( 8 "runtime" 9 "sync/atomic" 10 ) 11 12 var poolByCores = make([]TimingHeap, runtime.NumCPU()) 13 14 func init() { 15 // var coreNumbers = runtime.GOMAXPROCS(0) 16 // TODO::: 17 } 18 19 // destroy releases all of the resources associated with timers in specific CPU core and 20 // move them to other core 21 func (th *TimingHeap) destroy() { 22 if len(th.timers) > 0 { 23 th.timersLock.Lock() 24 th.moveTimers(plocal, th.timers) 25 th.timers = nil 26 th.numTimers = 0 27 th.deletedTimers = 0 28 atomic.StoreInt64(&th.timer0When, 0) 29 th.timersLock.Unlock() 30 } 31 }