schedgroup

package
v0.0.0-...-04966db Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

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

A Group is a goroutine worker pool which schedules tasks to be performed after a specified time. A Group must be created with the New constructor.

func New

func New(ctx context.Context) *Group

New creates a new Group which will use ctx for cancelation.

func (*Group) Delay

func (g *Group) Delay(delay time.Duration, fn func())

Delay schedules a function to run at or after the specified delay. Delay is a convenience wrapper for Schedule which adds delay to the current time.

func (*Group) Schedule

func (g *Group) Schedule(when time.Time, fn func())

Schedule schedules a function to run at or after the specified time.

func (*Group) Wait

func (g *Group) Wait() error

Wait waits for the completion of all scheduled tasks, or for context cancelation.

Jump to

Keyboard shortcuts

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