cleanup
Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
parent
d112f7148e
commit
a39a2f398a
@ -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)
|
||||
return
|
||||
default:
|
||||
g.wg.Done()
|
||||
}
|
||||
}
|
||||
g.wg.Add(-int(g.c.Load()))
|
||||
<-done
|
||||
return
|
||||
case <-done:
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user