parallel

package
v2.0.0-...-21b5c0c Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close waits all jobs to finish and closes the semaphore of global ParallelManager.

func Init

func Init(workercount int)

Init tries to increase the soft limit of open files and creates new global ParallelManager.

func Run

func Run(task Task, waiter *Waiter)

Run runs global ParallelManager.

Types

type Manager

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

Manager is a structure for running tasks in parallel.

func New

func New(workercount int) *Manager

New creates a new parallel.Manager.

func (*Manager) Close

func (p *Manager) Close()

Close waits all tasks to finish.

func (*Manager) Run

func (p *Manager) Run(fn Task, waiter *Waiter)

Run runs the given task while limiting the concurrency.

type Task

type Task func() error

Task is a function type for parallel manager.

type Waiter

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

Waiter is a structure for waiting and reading error messages created by Manager.

func NewWaiter

func NewWaiter() *Waiter

NewWaiter creates a new parallel.Waiter.

func (*Waiter) Err

func (w *Waiter) Err() <-chan error

Err returns read-only error channel.

func (*Waiter) Wait

func (w *Waiter) Wait()

Wait blocks until the WaitGroup counter is zero and closes error channel.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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