sync/waitgroup: initial sync.WaitGroup wrapper with context support #319

Merged
vtolstov merged 7 commits from waitgroup into master 2024-03-09 23:35:14 +03:00
Showing only changes of commit 1759bec5a9 - Show all commits

View File

@ -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) {