Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer represents a single event. When the Timer expires, the given task will be executed.
func (*Timer) Stop ¶
Stop prevents the Timer from firing. It returns true if the call stops the ticker, false if the ticker has already expired or been stopped.
If the ticker t has already expired and the t.task has been started in its own goroutine; Stop does not wait for t.task to complete before returning. If the caller needs to know whether t.task is completed, it must coordinate with t.task explicitly.
type TimerParams ¶
type TimerParams struct { Seconds int Args interface{} Cb timerCB }
type TimingWheel ¶
type TimingWheel struct {
// contains filtered or unexported fields
}
TimingWheel is an implementation of Hierarchical Timing Wheels.
func NewTimingWheel ¶
func NewTimingWheel(tick time.Duration, wheelSize int64) *TimingWheel
NewTimingWheel creates an instance of TimingWheel with the given tick and wheelSize.
func (*TimingWheel) AfterFunc ¶
func (tw *TimingWheel) AfterFunc(d time.Duration, f func()) *Timer
AfterFunc waits for the duration to elapse and then calls f in its own goroutine. It returns a Timer that can be used to cancel the call using its Stop method.
func (*TimingWheel) Stop ¶
func (tw *TimingWheel) Stop()
Stop stops the current timing wheel.
If there is any ticker's task being running in its own goroutine, Stop does not wait for the task to complete before returning. If the caller needs to know whether the task is completed, it must coordinate with the task explicitly.
type WbTimer ¶
type WbTimer struct {
// contains filtered or unexported fields
}
func StartTimer ¶
func StartTimer(params TimerParams) *WbTimer