Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ErrorGroup ¶
type ErrorGroup struct {
// contains filtered or unexported fields
}
An ErrorGroup is a collection of goroutines working on subtasks that are part of the same overall task.
func NewErrorGroup ¶
NewErrorGroup returns a new ErrorGroup instance
func (*ErrorGroup) Add ¶
func (g *ErrorGroup) Add(closures ...func() error)
Add calls the given function in a new goroutine.
The first call to return a non-nil error cancels the group; its error will be returned by Wait.
func (*ErrorGroup) Wait ¶
func (g *ErrorGroup) Wait() error
Wait blocks until all function calls from the Go method have returned, then returns the first non-nil error (if any) from them.
type WaitGroup ¶
type WaitGroup struct {
// contains filtered or unexported fields
}
WaitGroup implements a simple goruntine pool.
func NewWaitGroup ¶
NewWaitGroup creates a waitgroup with a specific size (the maximum number of goroutines to run at the same time). If you use -1 as the size, all items will run concurrently (just like a normal sync.WaitGroup)
func (*WaitGroup) Add ¶
func (wg *WaitGroup) Add(closures ...func())
Add add the function close to the waitgroup
func (*WaitGroup) BlockAdd ¶
func (wg *WaitGroup) BlockAdd()
BlockAdd pushes ‘one’ into the group. Blocks if the group is full.
func (*WaitGroup) PendingCount ¶
PendingCount returns the number of pending operations