interval

package
v1.107.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 14, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type IntervalRunner

type IntervalRunner struct {
	// contains filtered or unexported fields
}

IntervalRunner is an example implementation of AtomicRunState.

func NewIntervalRunner

func NewIntervalRunner(action func(), interval time.Duration) *IntervalRunner

NewIntervalRunner Creates a new instance of an interval runner to execute the provided function on a designated interval until explicitly stopped.

func (*IntervalRunner) Start

func (ir *IntervalRunner) Start() bool

Start begins the interval execution. It returns true if the interval execution successfully starts. It will return false if the interval execcution is already running.

func (*IntervalRunner) Stop

func (ir *IntervalRunner) Stop() bool

Stop will explicitly stop the execution of the interval runner. If an action is already executing, it will wait until completion before processing the stop. Any attempts to start during the stopping phase will block until it's possible to Start() again

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL