Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupTimer ¶
CleanupTimer stops the timer and drains the Timer's channel. This cannot be done concurrent to other receives from the Timer's channel or other calls to the Timer's Stop method.
Types ¶
type PrecisionTicker ¶
type PrecisionTicker struct {
// contains filtered or unexported fields
}
PrecisionTicker is a ticker that can be used on systems (like windows) that do not offer a high enough time resolution for very fast ticker intervals.
func NewPrecisionTicker ¶
func NewPrecisionTicker(callback func(), rate time.Duration, options ...PrecisionTickerOption) (precisionTicker *PrecisionTicker)
NewPrecisionTicker creates a new PrecisionTicker instance that executes the given callback function at the given rate.
func (*PrecisionTicker) Iterations ¶
func (p *PrecisionTicker) Iterations() (iterations int)
Iterations returns the number of iterations that the ticker has performed.
func (*PrecisionTicker) Shutdown ¶
func (p *PrecisionTicker) Shutdown()
Shutdown shuts down the ticker.
func (*PrecisionTicker) WaitForGracefulShutdown ¶
func (p *PrecisionTicker) WaitForGracefulShutdown()
WaitForGracefulShutdown waits for the ticker to shut down gracefully.
func (*PrecisionTicker) WaitForShutdown ¶
func (p *PrecisionTicker) WaitForShutdown()
WaitForShutdown waits for the ticker to shut down.
type PrecisionTickerOption ¶
type PrecisionTickerOption func(*precisionTickerOptions)
PrecisionTickerOption is a function that can be used to configure a PrecisionTicker.
func WithMaxIterations ¶
func WithMaxIterations(maxIterations int) PrecisionTickerOption
WithMaxIterations sets the maximum number of iterations that the ticker will perform.
func WithMinTimePrecision ¶
func WithMinTimePrecision(minTimePrecision time.Duration) PrecisionTickerOption
WithMinTimePrecision sets the assumed minimum time precision of the system.
type Ticker ¶
type Ticker struct {
// contains filtered or unexported fields
}
Ticker is task that gets executed repeatedly. It adjusts the intervals or drops ticks to make up for slow executions.
func NewTicker ¶
NewTicker creates a new Ticker from the given details. The interval must be greater than zero; if not, NewTicker will panic.
func (*Ticker) WaitForGracefulShutdown ¶
func (t *Ticker) WaitForGracefulShutdown()
WaitForGracefulShutdown waits until the Ticker was shut down and the last handler has terminated.
func (*Ticker) WaitForShutdown ¶
func (t *Ticker) WaitForShutdown()
WaitForShutdown waits until the Ticker was shut down.