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