util

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OnErrorFunc

type OnErrorFunc func(err error)

OnErrorFunc is a function which is called when an error from the SyncFunc is returned.

type SyncFunc

type SyncFunc func() error

SyncFunc is a function which is called in a synchronized manner.

type SyncIntervalTimer

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

SyncIntervalTimer is a timer which executes a given function by the given interval.

func NewSyncIntervalTimer

func NewSyncIntervalTimer(interval time.Duration, f SyncFunc, onError OnErrorFunc) *SyncIntervalTimer

NewSyncIntervalTimer creates a new SyncIntervalTimer with the given function and interval. onError can be nil.

func (*SyncIntervalTimer) Pause

func (sit *SyncIntervalTimer) Pause()

Pause awaits the currently executing function to return and then pauses the interval loop.

func (*SyncIntervalTimer) Resume

func (sit *SyncIntervalTimer) Resume()

Resume resumes the interval loop.

func (*SyncIntervalTimer) Start

func (sit *SyncIntervalTimer) Start()

Start starts the timer loop. This function blocks the caller until the timer is stopped.

func (*SyncIntervalTimer) Stop

func (sit *SyncIntervalTimer) Stop()

Stop awaits the currently executing function to return and then stops the interval loop.

Jump to

Keyboard shortcuts

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