jobtokens

package
v0.0.0-...-fb0f190 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JobTokens

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

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

func New

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

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

func (*JobTokens) Give

func (jt *JobTokens) Give()

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

func (*JobTokens) Take

func (jt *JobTokens) Take()

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

func (*JobTokens) Wait

func (jt *JobTokens) 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