runctx

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNotifySignals = []os.Signal{
	syscall.SIGINT,
	syscall.SIGTERM,
	syscall.SIGQUIT,
}

DefaultNotifySignals specifies signals that would cause the context to be canceled.

Functions

This section is empty.

Types

type Group added in v1.0.2

type Group struct {
	NotifySignals []os.Signal
	// contains filtered or unexported fields
}

Group is a collection of functions that would be run concurrently. The context passed to each function is canceled when any of the signals in NotifySignals is received.

func NewGroup added in v1.0.2

func NewGroup(fn ...func(ctx context.Context) error) *Group

func (*Group) Add added in v1.0.2

func (g *Group) Add(fn func(ctx context.Context) error)

func (*Group) Run added in v1.0.2

func (g *Group) Run() error

Run runs all the functions concurrently. See RunContext for more details.

func (*Group) RunContext added in v1.0.2

func (g *Group) RunContext(ctx context.Context) error

RunContext runs all the functions concurrently. It returns the first error returned by any of the functions. If the context is canceled, it returns nil.

Jump to

Keyboard shortcuts

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