parallel

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: Apache-2.0 Imports: 4 Imported by: 20 modules, 32 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 NewBounedRunner

func NewBounedRunner(maxParallel int, failFast bool) *runner

Create a new single capacity runner - a runner we can only add tasks to as long as there is a free goroutine in the Run() loop to handle it. maxParallel - number of go routines for task processing, maxParallel always will be a positive number. failFast - if set to true the runner will stop on first error.

func NewRunner

func NewRunner(maxParallel int, capacity uint, failFast bool) *runner

Create a new capacity runner - a runner we can add tasks to without blocking as long as the capacity is not reached. maxParallel - number of go routines for task processing, maxParallel always will be a positive number. acceptBeforeBlocking - number of tasks that can be added until a free processing goroutine is needed. failFast - is set to true the will stop on first error.

Types

type OnErrorFunc

type OnErrorFunc func(error)

type Runner

type Runner interface {
	AddTask(TaskFunc) (int, error)
	AddTaskWithError(TaskFunc, OnErrorFunc) (int, error)
	Run()
	Done()
	Cancel(bool)
	Errors() map[int]error
	ActiveThreads() uint32
	OpenThreads() uint32
	IsStarted() bool
	SetMaxParallel(int)
	GetFinishedNotification() chan bool
	SetFinishedNotification(bool)
	ResetFinishNotificationIfActive()
}

type TaskFunc

type TaskFunc func(int) error

Jump to

Keyboard shortcuts

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