supervisor

package module
v0.0.0-...-3b5c7a5 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2019 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 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

Overview

Package supervisor implements a common pattern for network programs: multiple goroutines are listening at network sockets, and the first error should be transmitted to all the other routines.

See also https://godoc.org/golang.org/x/sync/errgroup

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Supervisor

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

Supervisor is the top-level group

func WithContext

func WithContext(ctx context.Context) (*Supervisor, context.Context)

WithContext returns a new Group and an associated Context derived from ctx.

The derived Context is canceled the first time an agent returns a non-nil error, or when all agents are successfully completed.

func (*Supervisor) Agent

func (s *Supervisor) Agent(f func() error)

Agent adds a new routine to the group.

func (*Supervisor) Err

func (s *Supervisor) Err() <-chan error

Err returns a channel that will deliver a single value on the first error in the group, or nil if no error occurred, but there are no routines left in the group.

Jump to

Keyboard shortcuts

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