workers

package
v2.0.17 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2024 License: AGPL-3.0 Imports: 2 Imported by: 2

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