pool

package
v3.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pool

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

Pool is an abstraction of a pool of workers. That means, a set of goroutines that do some work.

func New

func New(ctx context.Context, workers int) Pool

New constructs a new instance of a Pool, ready to use.

func (Pool) BareRun

func (p Pool) BareRun(ctx context.Context, fn func(), nop func())

BareRun is similar to [Run] but it also accepts a function that will be executed when the given work function cannot be handled by the pool workers.

func (Pool) Close

func (p Pool) Close()

Close closes the Pool. It is blocking, and it waits until all th work is done.

func (Pool) Run

func (p Pool) Run(ctx context.Context, fn func())

Run pushes some work function (a `func()`) to the pool.

Jump to

Keyboard shortcuts

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