31
34
// G3: Wait() // G1 still hasn't run, G3 finds sema == 1, unblocked! Bug.
33
36
// Add adds delta, which may be negative, to the WaitGroup counter.
35
44
func (wg *WaitGroup) Add(delta int) {
36
51
v := atomic.AddInt32(&wg.counter, int32(delta))
40
55
if v > 0 || atomic.LoadInt32(&wg.waiters) == 0 {