Documentation ¶
Index ¶
- func DelMillisecond(t *Millisecond)
- func DelSecond(t *Second)
- type Millisecond
- type OnTimerFun
- type Second
- type TimerMgr
- func (p *TimerMgr) AddMillisecond(cb OnTimerFun, arg interface{}, expireMillisecond int64) (t *Millisecond)
- func (p *TimerMgr) AddSecond(cb OnTimerFun, arg interface{}, expire int64) (t *Second)
- func (p *TimerMgr) Start(scanSecondDuration time.Duration, scanMillisecondDuration time.Duration, ...)
- func (p *TimerMgr) Stop()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DelMillisecond ¶
func DelMillisecond(t *Millisecond)
DelMillisecond 删除毫秒级定时器(必须与该timerOutChan线性处理.如:在同一个goroutine select中处理数据.)
Types ¶
type Millisecond ¶
type Millisecond struct { Arg interface{} //参数 Function OnTimerFun //超时调用的函数 // contains filtered or unexported fields }
Millisecond 毫秒级定时器
type TimerMgr ¶
type TimerMgr struct {
// contains filtered or unexported fields
}
TimerMgr 定时器管理器
func (*TimerMgr) AddMillisecond ¶
func (p *TimerMgr) AddMillisecond(cb OnTimerFun, arg interface{}, expireMillisecond int64) (t *Millisecond)
AddMillisecond 添加毫秒级定时器
func (*TimerMgr) AddSecond ¶
func (p *TimerMgr) AddSecond(cb OnTimerFun, arg interface{}, expire int64) (t *Second)
AddSecond 添加秒级定时器
func (*TimerMgr) Start ¶
func (p *TimerMgr) Start(scanSecondDuration time.Duration, scanMillisecondDuration time.Duration, timerOutChan chan<- interface{})
Start scanSecondDuration:扫描秒级定时器, 纳秒间隔(如100000000,则每100毫秒扫描一次秒定时器) Start scanMillisecondDuration:扫描毫秒级定时器, 纳秒间隔(如100000000,则每100毫秒扫描一次毫秒定时器) timerOutChan 是超时事件放置的channel,由外部传入(处理定时器相关数据,必须与该timerOutChan线性处理.如:在同一个goroutine select中处理数据.)
Click to show internal directories.
Click to hide internal directories.