vRp.CD2g_test/utils/timer/timer.go

18 lines
594 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package timer
var (
tickerPoolSize = DefaultTickerPoolSize
standardPool = NewPool(tickerPoolSize)
)
// SetPoolSize 设置标准池定时器池大小
// - 默认值为 DefaultTickerPoolSize当定时器池中的定时器不足时会自动创建新的定时器当定时器释放时会将多余的定时器进行释放否则将放入定时器池中
func SetPoolSize(size int) {
_ = standardPool.ChangePoolSize(size)
}
// GetTicker 获取标准池中的一个定时器
func GetTicker(size int, options ...Option) *Ticker {
return standardPool.GetTicker(size, options...)
}