timermanager

package
v0.0.0-...-ce4c9c0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2021 License: BSD-2-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TimerCallback

type TimerCallback func(interface{})

TimerCallback is the type for timer callback functions

type TimerManager

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

TimerManager manages multiple timers

func NewTimerManager

func NewTimerManager() *TimerManager

NewTimerManager creates and returns a new timer manager

func (*TimerManager) ClearTimeout

func (tm *TimerManager) ClearTimeout(id int) bool

ClearTimeout clears the timeout specified by the id. Returns true if the timeout is found.

func (*TimerManager) Initialize

func (tm *TimerManager) Initialize()

Initialize initializes the timer manager. It is normally used when the TimerManager is embedded in another type.

func (*TimerManager) ProcessTimers

func (tm *TimerManager) ProcessTimers()

ProcessTimers should be called periodically to process the timers

func (*TimerManager) SetInterval

func (tm *TimerManager) SetInterval(td time.Duration, arg interface{}, cb TimerCallback) int

SetInterval sets a periodic timeout with the specified duration and callback The function returns the timeout id which can be used to cancel the timeout

func (*TimerManager) SetTimeout

func (tm *TimerManager) SetTimeout(td time.Duration, arg interface{}, cb TimerCallback) int

SetTimeout sets a timeout with the specified duration and callback The function returns the timeout id which can be used to cancel the timeout

Jump to

Keyboard shortcuts

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