errgroup

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NotifyContext

func NotifyContext(ctx context.Context) (context.Context, context.CancelFunc)

NotifyContext returns a copy of the parent context that is marked done when one of the listed signals arrives

Types

type Group

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

A Group is a collection of goroutines working on subtasks that are part of the same overall task.

func New

func New(ctx context.Context, funcs ...func(context.Context) error) *Group

A New Group with a shared Context

func (*Group) Go

func (g *Group) Go(funcs ...func(context.Context) error)

Go calls the given function in a new goroutine. It blocks until the new goroutine can be added without the number of active goroutines in the group exceeding the configured limit.

func (*Group) Wait

func (g *Group) Wait() error

Wait blocks until all function calls from the Go method have returned, then returns the first non-nil error (if any) from them.

Jump to

Keyboard shortcuts

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