timeutil

package
v0.0.0-...-25ef478 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2023 License: Apache-2.0, BSD-2-Clause Imports: 3 Imported by: 4 modules, 14 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sleep

func Sleep(ctx context.Context, d time.Duration) bool

Sleep pauses the current goroutine for the duration d or until the context ctx is cancelled. It returns whether Sleep paused for the entire duration or was cancelled before that.

Types

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

func NewTicker(handler func(), interval time.Duration, ctx ...context.Context) (ticker *Ticker)

NewTicker creates a new Ticker from the given details. The interval must be greater than zero; if not, NewTicker will panic.

func (*Ticker) Shutdown

func (t *Ticker) Shutdown()

Shutdown shuts down the Ticker.

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.

Jump to

Keyboard shortcuts

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