-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
testing: are T.Run and B.Run safe for concurrent use? #18603
Comments
If \cc @mpvl (moving to Go1.8Maybe; I don't think this is a release blocker at this point) |
Not sure whether @mpvl is around. Sent https://go-review.googlesource.com/35354. |
CL https://golang.org/cl/35354 mentions this issue. |
CL https://golang.org/cl/35354 added this comment to B.Run():
Which I don't think is true at all: calling B.Run() multiple times from multiple goroutines results in benchmarkLock.Unlock() being called multiple times before benchmarkLock.Lock(), which causes a crash. (example code: https://play.golang.org/p/0u15AvArTK) |
Is this a documentation issue or a implementation issue? cl/35354 does have a test for multiple goroutines using when using Are you proposing we properly making |
I don't mind which way it gets resolved, but it's significantly less effort to just remove the comment. |
Change https://golang.org/cl/80841 mentions this issue: |
I do not see any documentation specifying if T.Run is safe for concurrent use. I see the following doc for testing.T, which does not mention T.Run:
There is a similar doc for testing.B.
I ask because I believe T.Run was safe for concurrent use in go 1.7. Then, this line was added in go 1.8, which made T.Run no longer safe for concurrent use. I don't particularly care whether T.Run is safe for concurrent use, but I think the semantics should be clarified.
Optimistically labeling this go1.8.
/cc @dsnet
The text was updated successfully, but these errors were encountered: