Documentation ¶
Overview ¶
Package waitgroup implements SafeWaitGroup wrap of sync.WaitGroup. Add with positive delta when waiting will fail, to prevent sync.WaitGroup race issue.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SafeWaitGroup ¶
type SafeWaitGroup struct {
// contains filtered or unexported fields
}
SafeWaitGroup must not be copied after first use.
func (*SafeWaitGroup) Add ¶
func (wg *SafeWaitGroup) Add(delta int) error
Add adds delta, which may be negative, similar to sync.WaitGroup. If Add with a positive delta happens after Wait, it will return error, which prevent unsafe Add.
func (*SafeWaitGroup) Wait ¶
func (wg *SafeWaitGroup) Wait()
Wait blocks until the WaitGroup counter is zero.
Click to show internal directories.
Click to hide internal directories.