hep: go-hep.org/x/hep/fwk/utils/parallel Index | Files

package parallel

import "go-hep.org/x/hep/fwk/utils/parallel"

The parallel package provides a way of running functions concurrently while limiting the maximum number running at once.

Index

Package Files

parallel.go

type Errors Uses

type Errors []error

Errors holds any errors encountered during the parallel run.

func (Errors) Error Uses

func (errs Errors) Error() string

type Run Uses

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

Run represents a number of functions running concurrently.

func NewRun Uses

func NewRun(maxPar int) *Run

NewRun returns a new parallel instance. It will run up to maxPar functions concurrently.

func (*Run) Do Uses

func (r *Run) 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 (*Run) Wait Uses

func (r *Run) 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.

Package parallel imports 2 packages (graph). Updated 2018-08-02. Refresh now. Tools for package owners.