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
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.

Comments

@mostynb
Copy link
Contributor

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

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

@mvdan
Copy link
Member

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 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
@odeke-em odeke-em added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label 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
@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.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants