Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync: WaitGroup Add vs Done keeps confusing people #8543

Closed
gopherbot opened this issue Aug 18, 2014 · 3 comments
Closed

sync: WaitGroup Add vs Done keeps confusing people #8543

gopherbot opened this issue Aug 18, 2014 · 3 comments

Comments

@gopherbot
Copy link

sync.WaitGroup docs say "Note that calls with positive delta must happen before the
call to Wait, or else Wait may wait for too small a group."

This is notoriously confusing. Given
https://golang.org/issue/8054?c=10 :

"The rule for WaitGroup is: all Add's that can transition the counter from 0 to
>0 must happen before Wait. Add's with negative values, or Add's with positive values
which start when counter >0 can be executed at any time."


If that really is the guarantee, could the documentation be changed to state that? As
is, people read that "calls" as "all calls" or "at least one
call", and those lead to very different behavior.
@gopherbot
Copy link
Author

Comment 1:

CL https://golang.org/cl/123580043 mentions this issue.

@adg
Copy link
Contributor

adg commented Aug 18, 2014

Comment 2:

https://golang.org/cl/123580043
But I don't think it will help much.

Owner changed to @adg.

Status changed to Started.

@adg
Copy link
Contributor

adg commented Aug 21, 2014

Comment 3:

This issue was closed by revision bc64c07.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jun 25, 2018
Fixes golang#8543.

LGTM=dvyukov, r
R=rsc, r
CC=dvyukov, golang-codereviews
https://golang.org/cl/123580043
wheatman pushed a commit to wheatman/go-akaros that referenced this issue Jul 9, 2018
Fixes golang#8543.

LGTM=dvyukov, r
R=rsc, r
CC=dvyukov, golang-codereviews
https://golang.org/cl/123580043
@rsc rsc unassigned adg Jun 23, 2022
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants