Commit 984e81f6 authored by Ian Lance Taylor's avatar Ian Lance Taylor

doc/faq: clarify that concurrent maps reads are safe

Fixes #23480

Change-Id: I33b4bdc60b9983ab62d87bfa0ae3ff33304269c0
Reviewed-on: https://go-review.googlesource.com/88515Reviewed-by: default avatarRob Pike <r@golang.org>
parent 68ce117c
...@@ -479,6 +479,15 @@ as when hosting an untrusted program, the implementation could interlock ...@@ -479,6 +479,15 @@ as when hosting an untrusted program, the implementation could interlock
map access. map access.
</p> </p>
<p>
Map access is unsafe only when updates are occurring.
As long as all goroutines are only reading—looking up elements in the map,
including iterating through it using a
<code>for</code> <code>range</code> loop—and not changing the map
by assigning to elements or doing deletions,
it is safe for them to access the map concurrently without synchronization.
</p>
<h3 id="language_changes"> <h3 id="language_changes">
Will you accept my language change?</h3> Will you accept my language change?</h3>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment