File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ type Once struct {
2121 _ noCopy
2222
2323 // done indicates whether the action has been performed.
24- // It is first in the struct because it is used in the hot path.
24+ // It is first (ignoring noCopy) in the struct because it is used in the hot path.
2525 // The hot path is inlined at every call site.
2626 // Placing done first allows more compact instructions on some architectures (amd64/386),
2727 // and fewer instructions (to calculate offset) on other architectures.
@@ -52,7 +52,7 @@ type Once struct {
5252func (o * Once ) Do (f func ()) {
5353 // Note: Here is an incorrect implementation of Do:
5454 //
55- // if o.done.CompareAndSwap(0, 1 ) {
55+ // if o.done.CompareAndSwap(false, true ) {
5656 // f()
5757 // }
5858 //
You can’t perform that action at this time.
0 commit comments