servicegroup

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: MIT Imports: 3 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 set of subtasks that occur as part of a parent task which runs until an error occurs or its context is canceled.

func NewGroup

func NewGroup(ctx context.Context) *Group

NewGroup returns a Group that is bound to ctx. No new tasks can be started once the group's context has been canceled.

func (*Group) Go

func (g *Group) Go(
	fn func(context.Context) error,
) error

Go calls the given function in a new goroutine.

It returns a non-nil error if the group's context has been canceled, or another task has returned a non-nil error.

The context passed to fn is canceled when the group's context is canceled, or some other task returns a non-nil error.

func (*Group) Wait

func (g *Group) Wait() error

Wait blocks until an error occurs or the group's context is canceled.

Jump to

Keyboard shortcuts

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