Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HeapTimer ¶
type HeapTimer struct {
// contains filtered or unexported fields
}
HeapTimer
type HeapTimerMgr ¶
type HeapTimerMgr struct {
// contains filtered or unexported fields
}
func NewHeapTimerMgr ¶
func NewHeapTimerMgr() *HeapTimerMgr
NewHeapTimerMgr creates an initialized HeapTimerMgr.
func (*HeapTimerMgr) OnceTimer ¶
func (mgr *HeapTimerMgr) OnceTimer(d time.Duration, f func()) Timer
OnceTimer waits for the duration to elapse and then calls f in its own goroutine. It returns a Timer. It's done once
func (*HeapTimerMgr) RepeatTimer ¶
func (mgr *HeapTimerMgr) RepeatTimer(d time.Duration, f func()) Timer
RepeatTimer waits for the duration to elapse and then calls f in its own goroutine. It returns a Timer. It can be used to cancel the call using its Stop method.
type TimeWheelMgr ¶
type TimeWheelMgr struct {
// contains filtered or unexported fields
}
func NewTimeWheelMgr ¶
func NewTimeWheelMgr(interval time.Duration, bucketNum int) *TimeWheelMgr
NewTimeWheelMgr
func (*TimeWheelMgr) OnceTimer ¶
func (mgr *TimeWheelMgr) OnceTimer(d time.Duration, f func()) Timer
OnceTimer waits for the duration to elapse and then calls f in its own goroutine. It returns a Timer. It's done once
func (*TimeWheelMgr) RepeatTimer ¶
func (mgr *TimeWheelMgr) RepeatTimer(d time.Duration, f func()) Timer
RepeatTimer waits for the duration to elapse and then calls f in its own goroutine. It returns a Timer. It can be used to cancel the call using its Stop method.
type Timer ¶
type Timer interface {
// Reset changes the timer to expire after duration d.
// It returns true if the timer had been active or had executed,
// false if the timer been stopped.
Reset(duration time.Duration) bool
// Stop prevents the Timer from firing.
// It returns true if the call stops the timer, false if the timer has already
// been stopped.
Stop() bool
}
type TimerMgr ¶
type TimerMgr interface {
// OnceTimer waits for the duration to elapse and then calls f
// in its own goroutine. It returns a Timer. It's done once
OnceTimer(d time.Duration, f func()) Timer
// RepeatTimer waits for the duration to elapse and then calls f
// in its own goroutine. It returns a Timer. It can be used to
// cancel the call using its Stop method.
RepeatTimer(d time.Duration, f func()) Timer
}
TimerMgr interface
type WheelTimer ¶
type WheelTimer struct {
// contains filtered or unexported fields
}
func (*WheelTimer) Reset ¶
func (t *WheelTimer) Reset(d time.Duration) bool
Reset changes the timer to expire after duration d. It returns true if the timer had been active or had executed, false if the timer been stopped.
func (*WheelTimer) Stop ¶
func (t *WheelTimer) Stop() bool
Stop prevents the Timer from firing. It returns true if the call stops the timer, false if the timer has already been stopped.