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

text/template: document thread safety #6985

Closed
gopherbot opened this issue Dec 19, 2013 · 5 comments
Closed

text/template: document thread safety #6985

gopherbot opened this issue Dec 19, 2013 · 5 comments

Comments

@gopherbot
Copy link

by infogulch:

None of the template modules specify whether they are thread-safe.

Specifically, neither text/template nor html/template contain the word
"thread" at all:
http://golang.org/pkg/text/template/
http://golang.org/pkg/html/template/

Since net/http spawns separate goroutines for each connection and html/template is so
commonly used with it (see various official tutorials), I believe it is highly likely
that html/template is, in fact, thread safe. However, the usual assumption is that a
module is not thread safe unless specifically indicated otherwise.

They should specify if they are thread-safe or not, and which operations are thread safe
if not all.
@adg
Copy link
Contributor

adg commented Dec 19, 2013

Comment 1:

The docs should state that at least Execute is thread safe.

Labels changed: added release-go1.3, repo-main.

Status changed to Accepted.

@dsymonds
Copy link
Contributor

dsymonds commented Jan 2, 2014

Comment 2:

Labels changed: added documentation, size-s.

Owner changed to @robpike.

@robpike
Copy link
Contributor

robpike commented Apr 10, 2014

Comment 3:

It's already documented:
// Once constructed, a template may be executed safely in parallel.
but I'll say it in more places.

@gopherbot
Copy link
Author

Comment 4:

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

@robpike
Copy link
Contributor

robpike commented Apr 15, 2014

Comment 5:

This issue was closed by revision aeb3752.

Status changed to Fixed.

@rsc rsc added this to the Go1.3 milestone Apr 14, 2015
@rsc rsc removed the release-go1.3 label Apr 14, 2015
@golang golang locked and limited conversation to collaborators Jun 25, 2016
@rsc rsc unassigned robpike Jun 22, 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

5 participants