Documentation ¶
Index ¶
- Constants
- Variables
- func TimerSetAccuracy(n int64) option
- func TimerSetNow(n time.Time) option
- type ITimer
- type Timer
- func (this *Timer) DeleteAllTimerTask()
- func (this *Timer) DeleteTimerTask(timerTaskID uint64)
- func (this *Timer) GetTickTime() time.Time
- func (this *Timer) Len() int
- func (this *Timer) LoopDelayTimer(delayTime time.Duration, intervalTime time.Duration, ...) uint64
- func (this *Timer) LoopDelayTimerByCount(delayTime time.Duration, intervalTime time.Duration, loopCount int, ...) uint64
- func (this *Timer) LoopTimer(intervalTime time.Duration, callback func(...interface{}), ...) uint64
- func (this *Timer) LoopTimerByCount(intervalTime time.Duration, loopCount int, callback func(...interface{}), ...) uint64
- func (this *Timer) OnTick(t time.Time)
- func (this *Timer) OnceTimer(delayTime time.Duration, callback func(...interface{}), params ...interface{}) uint64
- func (this *Timer) ReStart(t int64)
- func (this *Timer) Start()
- func (this *Timer) Stop()
- func (this *Timer) String() string
- type TimerTaskType
Constants ¶
View Source
const (
//最小一组数据的个数
ArrayListMax = 1000
)
Variables ¶
View Source
var ( PoolListE *sync.Pool PoolBucket *sync.Pool )
Functions ¶
Types ¶
type ITimer ¶
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() //获取当前tick时间 GetTickTime() time.Time }
type Timer ¶
type Timer struct { TimerWheelAccuracy int64 //最小时间刻度(毫秒) // contains filtered or unexported fields }
时间桶按毫秒运行
func (*Timer) DeleteTimerTask ¶
删除定时任务(非线程安全)
func (*Timer) LoopDelayTimer ¶
func (this *Timer) LoopDelayTimer(delayTime time.Duration, intervalTime time.Duration, callback func(...interface{}), params ...interface{}) uint64
循环延时任务 返回值(定时任务ID)
func (*Timer) LoopDelayTimerByCount ¶
func (this *Timer) LoopDelayTimerByCount(delayTime time.Duration, intervalTime time.Duration, loopCount int, callback func(...interface{}), params ...interface{}) uint64
循环任务(毫秒) 返回值(定时任务ID)
func (*Timer) LoopTimer ¶
func (this *Timer) LoopTimer(intervalTime time.Duration, callback func(...interface{}), params ...interface{}) uint64
循环任务 返回值(定时任务ID)
func (*Timer) LoopTimerByCount ¶
func (this *Timer) LoopTimerByCount(intervalTime time.Duration, loopCount int, callback func(...interface{}), params ...interface{}) uint64
循环次数任务 返回值(定时任务ID)
type TimerTaskType ¶
type TimerTaskType int64
定时任务类型
const ( TimerTask_one TimerTaskType = 1 //一次任务 TimerTask_loop TimerTaskType = 2 //循环任务 )
Click to show internal directories.
Click to hide internal directories.