parallel

package
v1.2.9 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2025 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package parallel provides utilities for running tasks in parallel.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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.

Jump to

Keyboard shortcuts

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