sync/waitgroup: initial sync.WaitGroup wrapper with context support #319
@ -7,9 +7,9 @@ import (
|
||||
)
|
||||
|
||||
type WaitGroup struct {
|
||||
mu sync.Mutex
|
||||
wg *sync.WaitGroup
|
||||
c *atomic.Int64
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
func WrapWaitGroup(wg *sync.WaitGroup) *WaitGroup {
|
||||
@ -22,11 +22,7 @@ func WrapWaitGroup(wg *sync.WaitGroup) *WaitGroup {
|
||||
|
||||
func NewWaitGroup() *WaitGroup {
|
||||
var wg sync.WaitGroup
|
||||
g := &WaitGroup{
|
||||
wg: &wg,
|
||||
c: &(atomic.Int64{}),
|
||||
}
|
||||
return g
|
||||
return WrapWaitGroup(&wg)
|
||||
}
|
||||
|
||||
func (g *WaitGroup) Add(n int) {
|
||||
|
Loading…
Reference in New Issue
Block a user