parallel

package
v0.0.0-...-e91a9a7 Latest Latest
Warning

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

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 2 Imported by: 7 modules, 36 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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Errors

type Errors []error

Errors holds any errors encountered during the parallel run.

func (Errors) Error

func (errs Errors) Error() string

type Run

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

Run represents a number of functions running concurrently.

func NewRun

func NewRun(maxPar int) *Run

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

func (*Run) Do

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

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.

Jump to

Keyboard shortcuts

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