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: why `v == int32(delta)` is required when judging if the waitgroup is misused? #39571

Closed
cncal opened this issue Jun 13, 2020 · 1 comment

Comments

@cncal
Copy link
Contributor

@cncal cncal commented Jun 13, 2020

What version of Go are you using (go version)?

$ go version
go version go1.14.2 darwin/amd64

Question?

Why v == int32(delta) is required here? Is w != 0 && delta > 0 insufficient to judge if a waitgroup is misused for Add called concurrently with Wait?

@davecheney
Copy link
Contributor

@davecheney davecheney commented Jun 13, 2020

Because delta is declared in the function declaration as int. There are no few implicit conversion rules in Go, so int and int32 are not the same type, even if the program is compiled on a 32 bit platform.

Unlike many projects on GitHub, the Go project does not use its bug tracker for general discussion or asking questions. We only use our bug tracker for tracking bugs and tracking proposals going through the Proposal Process.

Please see https://golang.org/wiki/Questions for good places to ask questions.

@davecheney davecheney closed this Jun 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.