diff --git a/sizedwaitgroup.go b/sizedwaitgroup.go index 4a0685d..716fdd1 100644 --- a/sizedwaitgroup.go +++ b/sizedwaitgroup.go @@ -37,7 +37,6 @@ func New(limit int) SizedWaitGroup { Size: size, current: make(chan struct{}, size), - wg: sync.WaitGroup{}, } } @@ -48,7 +47,8 @@ func New(limit int) SizedWaitGroup { // // See sync.WaitGroup documentation for more information. func (s *SizedWaitGroup) Add() { - s.AddWithContext(context.Background()) + s.current <- struct{}{} + s.wg.Add(1) } // AddWithContext increments the internal WaitGroup counter.