You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This racy behaviour is not documented at the sync.Waitgroup docs, so maybe it's a bug? Didn't expect a data race. Maybe a panic due to a send to a closed channel, but not a data race.
Note that calls with a positive delta that occur when the counter is zero must happen before a Wait. Calls with a negative delta, or calls with a positive delta that start when the counter is greater than zero, may happen at any time. Typically this means the calls to Add should execute before the statement creating the goroutine or other event to be waited for.
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
Run this test with the
-race
flag:This racy behaviour is not documented at the
sync.Waitgroup
docs, so maybe it's a bug? Didn't expect a data race. Maybe a panic due to a send to a closed channel, but not a data race.This fixes it:
The text was updated successfully, but these errors were encountered: