Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2024-03-09 20:03:24 +03:00
parent d112f7148e
commit a39a2f398a

View File

@ -57,16 +57,9 @@ func (g *WaitGroup) WaitContext(ctx context.Context) {
select {
case <-ctx.Done():
g.drain.Swap(true)
for g.c.Load() > 0 {
select {
case <-done:
g.drain.Swap(false)
g.wg.Add(-int(g.c.Load()))
<-done
return
default:
g.wg.Done()
}
}
case <-done:
return
}