parallel

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parallel

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

Parallel represents a number of functions running concurrently.

func WithContext

func WithContext(ctx context.Context, maxPar int) (*Parallel, context.Context)

WithContext returns a new parallel instance and an associated Context derived from ctx.. It will run up to maxPar functions concurrently.

func (*Parallel) Do

func (r *Parallel) Do(f func() error)

Do requests that r run f concurrently. If there are already the maximum number of functions running concurrently, it will block until one of them has completed. Do may itself be called concurrently.

func (*Parallel) Wait

func (r *Parallel) Wait() error

Wait marks the parallel instance as complete and waits for all the functions to complete. If any errors were encountered, it returns an Errors value describing all the errors in arbitrary order.

Jump to

Keyboard shortcuts

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