Documentation
¶
Overview ¶
Package concurrent makes it easy to process a list of things concurrently using a simple closure.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RunGrouped ¶
RunGrouped is like RunGroupedErr but without errors.
func RunGroupedErr ¶
RunGroupedErr the given func f concurrently using up to the specified number of maxThreads, or equal to the number of CPUs on the system if passed zero. The number of jobs is given by count, and the range of jobs [m, n) are passed to the callback f.
func RunSweep ¶
RunSweep is like RunSweepErr, but without errors.
func RunSweepErr ¶
RunSweepErr will use at most maxThreads (or equal to the number of CPUs on the system if zero), to run func f concurrently, returning the first error received. If an error is reported, some func f may not be executed.
Types ¶
type Runner ¶
Runner runs jobs with a specified maximum limit on concurrency.
func NewRunner ¶
NewRunner returns a new Runner that executes jobs concurrently with at most n jobs running at any one time.
func (*Runner) Errors ¶
Errors returns all of the errors reported by jobs. The order is given by job completion, not submission.
func (*Runner) Failures ¶
Failures returns the number of errors reported by jobs so far. This is useful for callers to fail-fast and stop submitting jobs if an error has been reported.
func (*Runner) Finish ¶
Finish waits for all executing jobs to complete, and returns the number of successful jobs completed.