timer

package
v1.4.26 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2023 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get added in v1.4.1

func Get(d time.Duration) *time.Timer

Get returns a timer that completes after the given duration.

func Put added in v1.4.1

func Put(t *time.Timer)

Put pools the given timer.

There is no need to call t.Stop() before calling Put.

Put will try to stop the timer before pooling. If the given timer already expired, Put will read the unreceived value if there is one.

Types

type Id

type Id = string

type Manager

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

func New

func New() *Manager

func (*Manager) Add

func (m *Manager) Add(now, endAt time.Time, timerCallback callback, times int, id ...Id) Id

func (*Manager) Cancel added in v1.4.0

func (m *Manager) Cancel(id Id, softRemove ...bool)

func (*Manager) Len

func (m *Manager) Len() int

func (*Manager) NextUpdateAt

func (m *Manager) NextUpdateAt() (at time.Time)

func (*Manager) Update

func (m *Manager) Update(now time.Time) time.Duration

Jump to

Keyboard shortcuts

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