From bca81f81f1889d696ce19fb22febc9de3c0c2cf1 Mon Sep 17 00:00:00 2001 From: Rob Pike Date: Mon, 20 Sep 2010 07:37:41 +1000 Subject: doc/go_mem.html: update location of "once". Fixes issue 1118. R=rsc CC=golang-dev http://codereview.appspot.com/2225044 --- doc/go_mem.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'doc/go_mem.html') 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 n+1'th call to l.Lock.

Once

-The once package provides a safe mechanism for -initialization in the presence of multiple goroutines. +The sync package provides a safe mechanism for +initialization in the presence of multiple goroutines +through the use of the Once type. Multiple threads can execute once.Do(f) for a particular f, but only one will run f(), and the other calls block until f() has returned. @@ -293,6 +294,7 @@ In this program:

 var a string
+var once sync.Once
 
 func setup() {
 	a = "hello, world"
-- 
cgit v1.2.1