1
0
mirror of https://github.com/golang/go synced 2024-11-25 08:07:57 -07:00

sync: improve once.Do documentation readability

The previous wording, though accurate, was hard to parse.
In particular, it was tempting to interpret "the method"
as referring to "the function f" instead of "Do", and
required effort to find the correct antecedent for
"this receiver".

R=golang-dev, bradfitz, r
CC=golang-dev
https://golang.org/cl/13307043
This commit is contained in:
Josh Bleecher Snyder 2013-08-28 12:53:59 +10:00 committed by Rob Pike
parent aff7ea9458
commit cbea724378

View File

@ -14,8 +14,8 @@ type Once struct {
done uint32
}
// Do calls the function f if and only if the method is being called for the
// first time with this receiver. In other words, given
// Do calls the function f if and only if Do is being called for the
// first time for this instance of Once. In other words, given
// var once Once
// if once.Do(f) is called multiple times, only the first call will invoke f,
// even if f has a different value in each invocation. A new instance of