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

encoding/gob: mention that Encoder and Decoder are safe for concurrent use #29416

Closed
mostynb opened this issue Dec 25, 2018 · 3 comments
Closed

encoding/gob: mention that Encoder and Decoder are safe for concurrent use #29416

mostynb opened this issue Dec 25, 2018 · 3 comments

Comments

@mostynb
Copy link
Contributor

@mostynb mostynb commented Dec 25, 2018

gob.Encoder and gob.Decoder use mutexes internally to allow concurrent usage, but I couldn't see this mentioned in the package documentation anywhere. It might be useful to do so.

mostynb added a commit to mostynb/go that referenced this issue Dec 25, 2018
…t use

Fixes golang#29416.

Change-Id: I24364bfee77aceace53f85f1046ef4d73f8feebb
@gopherbot
Copy link

@gopherbot gopherbot commented Dec 25, 2018

Change https://golang.org/cl/155742 mentions this issue: encoding/gob: mention that this is safe for concurrent usage

@mvdan
Copy link
Member

@mvdan mvdan commented Dec 26, 2018

I always forget if we need to document when named types and methods are safe for concurrent use, or when they're not. We should probably have a wiki page explaining this.

@mostynb
Copy link
Contributor Author

@mostynb mostynb commented Dec 26, 2018

I forget too, and so I default to treating things as unsafe for concurrent use until told otherwise- which seems like the most reasonable response.

If there's general agreement on if/what/how this should be documented, I would be happy to help make this more consistent across the standard library docs.

@odeke-em odeke-em changed the title mention that gob.Encoder and gob.Decoder are safe for concurrent use encoding/gob: mention that Encoder and Decoder are safe for concurrent use Dec 27, 2018
mostynb added a commit to mostynb/go that referenced this issue Dec 28, 2018
…t use

Fixes golang#29416.

Change-Id: I24364bfee77aceace53f85f1046ef4d73f8feebb
@gopherbot gopherbot closed this in d459962 Dec 28, 2018
@golang golang locked and limited conversation to collaborators Dec 28, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

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