Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type WaitGroup ¶
WaitGroup wraps sync.WaitGroup and makes safe to call Add/Wait from concurrent goroutines.
An additional limitation is that call to Wait prohibits further calls to Add until return.
func (*WaitGroup) Add ¶
Add registers n additional workers. Add may be called from concurrent goroutines.
func (*WaitGroup) Wait ¶
func (wg *WaitGroup) Wait()
Wait waits until all the goroutines call Done.
Wait may be called from concurrent goroutines.
Further calls to Add are blocked until return from Wait.
func (*WaitGroup) WaitAndBlock ¶
func (wg *WaitGroup) WaitAndBlock()
WaitAndBlock waits until all the goroutines call Done and then prevents from new goroutines calling Add.
Further calls to Add are always blocked. This is useful for graceful shutdown when other goroutines calling Add must be stopped.
wg cannot be used after this call.