Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WaitGroupWithError ¶
type WaitGroupWithError struct {
// contains filtered or unexported fields
}
WaitGroupWithError is a sync.WaitGroup that also tracks the errors that are generated in associated asynchronous work.
Example usage: var wg WaitGroupWithError
for _ := range bar { wg.Add(1) go func() { wg.Done(maybeError()) } }
wg.Wait() return wg.FirstError()
func (*WaitGroupWithError) Add ¶
func (wg *WaitGroupWithError) Add(delta int)
Add adds delta, which may be negative, to the WaitGroup counter. If the counter becomes zero, all goroutines blocked on Wait are released. If the counter goes negative, Add panics.
func (*WaitGroupWithError) Done ¶
func (wg *WaitGroupWithError) Done(err error)
Done decrements the WaitGroup counter and records the error if non-nil.
func (*WaitGroupWithError) FirstError ¶
func (wg *WaitGroupWithError) FirstError() error
FirstError returns the first error that was passed to Done (wrapped in a count of how many total errors there were) or nil if there were no errors.
func (*WaitGroupWithError) Wait ¶
func (wg *WaitGroupWithError) Wait()
Wait blocks until the WaitGroup counter is zero.