thread

package
v1.76.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 4 modules, 14 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parallelism

func Parallelism() int

Parallelism returns the current parallelism.

This defaults to the number of CPUs.

func Parallelize

func Parallelize(ctx context.Context, jobs []func(context.Context) error, options ...ParallelizeOption) error

Parallelize runs the jobs in parallel.

A max of Parallelism jobs will be run at once. Returns the combined error from the jobs.

func SetParallelism

func SetParallelism(parallelism int)

SetParallelism sets the parallelism.

If parallelism < 1, this sets the parallelism to 1.

Types

type ParallelizeOption added in v0.55.0

type ParallelizeOption func(*parallelizeOptions)

ParallelizeOption is an option to Parallelize.

func ParallelizeWithCancelOnFailure added in v1.38.0

func ParallelizeWithCancelOnFailure() ParallelizeOption

ParallelizeWithCancelOnFailure returns a new ParallelizeOption that will attempt to cancel all other jobs via context cancellation if any job fails.

func ParallelizeWithMultiplier added in v0.55.0

func ParallelizeWithMultiplier(multiplier int) ParallelizeOption

ParallelizeWithMultiplier returns a new ParallelizeOption that will use a multiple of Parallelism() for the number of jobs that can be run at once.

The default is to only do Parallelism() number of jobs. A multiplier of <1 has no meaning.

Jump to

Keyboard shortcuts

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