]> Cypherpunks repositories - gostls13.git/commitdiff
doc/go_mem.html: update location of "once".
authorRob Pike <r@golang.org>
Sun, 19 Sep 2010 21:37:41 +0000 (07:37 +1000)
committerRob Pike <r@golang.org>
Sun, 19 Sep 2010 21:37:41 +0000 (07:37 +1000)
Fixes #1118.

R=rsc
CC=golang-dev
https://golang.org/cl/2225044

doc/go_mem.html

index 33bce5f7a665b82979b5310ad3cd7e83dc68d007..78238900dda20631701211720d414f183db5d46f 100644 (file)
@@ -276,8 +276,9 @@ before the <i>n</i>+1'th call to <code>l.Lock</code>.
 <h3>Once</h3>
 
 <p>
-The <code>once</code> package provides a safe mechanism for
-initialization in the presence of multiple goroutines.
+The <code>sync</code> package provides a safe mechanism for
+initialization in the presence of multiple goroutines
+through the use of the <code>Once</code> type.
 Multiple threads can execute <code>once.Do(f)</code> for a particular <code>f</code>,
 but only one will run <code>f()</code>, and the other calls block
 until <code>f()</code> has returned.
@@ -293,6 +294,7 @@ In this program:
 
 <pre>
 var a string
+var once sync.Once
 
 func setup() {
        a = "hello, world"