diff options
author | Rob Pike <r@golang.org> | 2010-09-20 07:37:41 +1000 |
---|---|---|
committer | Rob Pike <r@golang.org> | 2010-09-20 07:37:41 +1000 |
commit | bca81f81f1889d696ce19fb22febc9de3c0c2cf1 (patch) | |
tree | 0fb5cc79cfa824f0b45ca8cdf2a4f8a970f05fba | |
parent | 3268cbc78169cf1c5178fd26d87751f0069541a6 (diff) | |
download | go-bca81f81f1889d696ce19fb22febc9de3c0c2cf1.tar.gz |
doc/go_mem.html: update location of "once".
Fixes issue 1118.
R=rsc
CC=golang-dev
http://codereview.appspot.com/2225044
-rw-r--r-- | doc/go_mem.html | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/go_mem.html b/doc/go_mem.html index 33bce5f7a..78238900d 100644 --- a/doc/go_mem.html +++ b/doc/go_mem.html @@ -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" |