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 e430c15ae8 - Show all commits

View File

@ -57,8 +57,9 @@ func (g *WaitGroup) WaitContext(ctx context.Context) {
select {
case <-ctx.Done():
g.drain.Store(true)
g.wg.Add(-int(g.c.Load()))
<-done
g.drain.Store(false)
return
case <-done:
return