Documentation ¶
Index ¶
- Constants
- func DelayAdd(delay time.Duration, interval time.Duration, job JobFunc)
- func DelayAddEntry(delay time.Duration, interval time.Duration, job JobFunc, singleton bool, ...)
- func DelayAddOnce(delay time.Duration, interval time.Duration, job JobFunc)
- func DelayAddSingleton(delay time.Duration, interval time.Duration, job JobFunc)
- func DelayAddTimes(delay time.Duration, interval time.Duration, times int, job JobFunc)
- func Exit()
- func SetInterval(interval time.Duration, job JobFunc)
- func SetTimeout(delay time.Duration, job JobFunc)
- type JobFunc
- type TEntry
- func Add(interval time.Duration, job JobFunc) *TEntry
- func AddEntry(interval time.Duration, job JobFunc, singleton bool, times int, status int) *TEntry
- func AddOnce(interval time.Duration, job JobFunc) *TEntry
- func AddSingleton(interval time.Duration, job JobFunc) *TEntry
- func AddTimes(interval time.Duration, times int, job JobFunc) *TEntry
- func (entry *TEntry) Close()
- func (entry *TEntry) IsSingleton() bool
- func (entry *TEntry) Run()
- func (entry *TEntry) SetSingleton(enabled bool)
- func (entry *TEntry) SetStatus(status int) int
- func (entry *TEntry) SetTimes(times int)
- func (entry *TEntry) Start()
- func (entry *TEntry) Status() int
- func (entry *TEntry) Stop()
- type TTimer
- func (t *TTimer) Add(interval time.Duration, job JobFunc) *TEntry
- func (t *TTimer) AddEntry(interval time.Duration, job JobFunc, singleton bool, times int, status int) *TEntry
- func (t *TTimer) AddOnce(interval time.Duration, job JobFunc) *TEntry
- func (t *TTimer) AddSingleton(interval time.Duration, job JobFunc) *TEntry
- func (t *TTimer) AddTimes(interval time.Duration, times int, job JobFunc) *TEntry
- func (t *TTimer) Close()
- func (t *TTimer) DelayAdd(delay time.Duration, interval time.Duration, job JobFunc)
- func (t *TTimer) DelayAddEntry(delay time.Duration, interval time.Duration, job JobFunc, singleton bool, ...)
- func (t *TTimer) DelayAddOnce(delay time.Duration, interval time.Duration, job JobFunc)
- func (t *TTimer) DelayAddSingleton(delay time.Duration, interval time.Duration, job JobFunc)
- func (t *TTimer) DelayAddTimes(delay time.Duration, interval time.Duration, times int, job JobFunc)
- func (t *TTimer) Start()
- func (t *TTimer) Stop()
Constants ¶
View Source
const ( STATUS_READY = 0 STATUS_RUNNING = 1 STATUS_STOPPED = 2 STATUS_CLOSED = -1 )
Variables ¶
This section is empty.
Functions ¶
func DelayAddEntry ¶
func DelayAddEntry(delay time.Duration, interval time.Duration, job JobFunc, singleton bool, times int, status int)
延迟添加循环任务, 支持完整的参数。
func DelayAddOnce ¶
延迟添加只运行一次的循环任务,delay参数单位为秒
func DelayAddSingleton ¶
延迟添加单例循环任务,delay参数单位为秒
func DelayAddTimes ¶
延迟添加运行指定次数的循环任务,delay参数单位为秒
func SetInterval ¶
类似与js中的SetInterval,每隔一段时间执行指定回调函数。
Types ¶
type TEntry ¶
type TEntry struct {
// contains filtered or unexported fields
}
循环任务项
type TTimer ¶
type TTimer struct {
// contains filtered or unexported fields
}
定时器/分层时间轮
func (*TTimer) AddEntry ¶
func (t *TTimer) AddEntry(interval time.Duration, job JobFunc, singleton bool, times int, status int) *TEntry
添加定时任务
func (*TTimer) AddSingleton ¶
添加单例运行循环任务
func (*TTimer) DelayAddEntry ¶
func (t *TTimer) DelayAddEntry(delay time.Duration, interval time.Duration, job JobFunc, singleton bool, times int, status int)
延迟添加循环任务, 支持完整的参数。
func (*TTimer) DelayAddOnce ¶
延迟添加只运行一次的循环任务
func (*TTimer) DelayAddSingleton ¶
延迟添加单例循环任务
func (*TTimer) DelayAddTimes ¶
延迟添加只运行一次的循环任务
Click to show internal directories.
Click to hide internal directories.