3 Star 1 Fork 0

NightTC / Gobige

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
init.go 1.36 KB
一键复制 编辑 原始数据 按行查看 历史
buguang 提交于 2023-05-08 20:38 . timerwheel
package timerwheel
import (
"sync"
"time"
)
const (
//最小一组数据的个数
ArrayListMax = 1000
)
var (
PoolListE *sync.Pool
PoolBucket *sync.Pool
)
func init() {
PoolListE = &sync.Pool{
New: func() any {
return new(taskModel)
},
}
PoolBucket = &sync.Pool{
New: func() any {
return new(bucket)
},
}
}
type ITimer interface {
//一次任务 返回值(定时任务ID)
OnceTimer(delayTime time.Duration, callback func(...interface{}), params ...interface{}) uint64
//循环任务 返回值(定时任务ID)
LoopTimer(intervalTime time.Duration, callback func(...interface{}), params ...interface{}) uint64
//循环次数任务 返回值(定时任务ID)
LoopTimerByCount(intervalTime time.Duration, loopCount int, callback func(...interface{}), params ...interface{}) uint64
//循环延时任务 返回值(定时任务ID)
LoopDelayTimer(delayTime time.Duration, intervalTime time.Duration, callback func(...interface{}), params ...interface{}) uint64
//循环任务(毫秒) 返回值(定时任务ID)
LoopDelayTimerByCount(delayTime time.Duration, intervalTime time.Duration, loopCount int, callback func(...interface{}), params ...interface{}) uint64
//删除定时任务(非线程安全)
DeleteTimerTask(timerTaskID uint64)
//删除所有定时任务(非线程安全)
DeleteAllTimerTask()
}
Go
1
https://gitee.com/night-tc/gobige.git
git@gitee.com:night-tc/gobige.git
night-tc
gobige
Gobige
00125336c61c

搜索帮助