waitgroup

package
v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2020 License: Apache-2.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 WaitGroup

type WaitGroup struct {
	Size int //maximun number of concurrently goroutines
	// contains filtered or unexported fields
}

WaitGroup has the same role and close to the same API as the Golang sync.WaitGroup but adds a limit of the amount of goroutines started concurrently.

func New

func New(limit int) WaitGroup

New creates a WaitGroup. The limit parameter is the maximum amount of goroutines which can be started concurrently.

func (*WaitGroup) Add

func (s *WaitGroup) Add()

Add increments the internal WaitGroup counter. It can be blocking if the limit of spawned goroutines has been reached.

func (*WaitGroup) Done

func (s *WaitGroup) Done()

Done decrements the SizedWaitGroup counter. See sync.WaitGroup documentation for more information.

func (*WaitGroup) Wait

func (s *WaitGroup) Wait()

Wait blocks until the SizedWaitGroup counter is zero. See sync.WaitGroup documentation for more information.

Jump to

Keyboard shortcuts

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