]> Cypherpunks repositories - gostls13.git/commit
sync: document implementation of Once.Do
authorRuss Cox <rsc@golang.org>
Sat, 29 Jun 2019 13:26:19 +0000 (09:26 -0400)
committerRuss Cox <rsc@golang.org>
Mon, 1 Jul 2019 14:45:49 +0000 (14:45 +0000)
commitbc593eac2dc63d979a575eccb16c7369a5ff81e0
tree5f2ee4388576493130dc36ed7cc6cf2cc771ef97
parentc485e8b55918b3b37e6eab47036ab6f16fec226d
sync: document implementation of Once.Do

It's not correct to use atomic.CompareAndSwap to implement Once.Do,
and we don't, but why we don't is a question that has come up
twice on golang-dev in the past few months.
Add a comment to help others with the same question.

Change-Id: Ia89ec9715cc5442c6e7f13e57a49c6cfe664d32c
Reviewed-on: https://go-review.googlesource.com/c/go/+/184261
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ingo Oeser <nightlyone@googlemail.com>
src/sync/once.go