limiter

package
v3.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2018 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

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

Limits the number of goroutines and allows you to wait for the worker group to complete.

func New

func New(k uint) *Limiter

Returns new limiter which restrains the size of worker group with number less or equal k.

func (*Limiter) Active

func (lim *Limiter) Active() int

Returns a number of active workers.

func (*Limiter) Start

func (lim *Limiter) Start() func()

Adds a new worker to groups and returns "done" function, which must be run to decrement worker counter.

func (*Limiter) Wait

func (lim *Limiter) Wait()

Blocks until all workers complete their tasks.

Jump to

Keyboard shortcuts

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