workers

package
v3.11.0 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2026 License: AGPL-3.0 Imports: 2 Imported by: 7 modules, 5 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

This section is empty.

Types

type Workers

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

Workers provides a bounded semaphore with the ability to wait until all concurrent jobs finish.

func New

func New(n int) (*Workers, error)

New creates a Workers object which allows up to n jobs to proceed concurrently. n must be > 0.

func (*Workers) Give

func (jt *Workers) Give()

Give is how a job (goroutine) can give back its turn once done.

func (*Workers) Take

func (jt *Workers) Take()

Take is how a job (goroutine) can Take its turn.

func (*Workers) Wait

func (jt *Workers) Wait()

Wait waits for all ongoing concurrent jobs to complete

Jump to

Keyboard shortcuts

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