1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:24:41 -07:00
go/src/sync
Russ Cox bc593eac2d 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>
2019-07-01 14:45:49 +00:00
..
atomic sync/atomic: add 32-bit MIPS to the 64-bit alignment requirement 2019-02-09 23:07:07 +00:00
cond_test.go
cond.go
example_pool_test.go
example_test.go
export_test.go sync: fix pool wrap-around test 2019-06-26 19:48:39 +00:00
map_bench_test.go
map_reference_test.go
map_test.go
map.go
mutex_test.go sync: allow inlining the Mutex.Unlock fast path 2019-03-05 14:59:31 +00:00
mutex.go sync: allow inlining the Mutex.Lock fast path 2019-03-09 05:08:04 +00:00
once_test.go
once.go sync: document implementation of Once.Do 2019-07-01 14:45:49 +00:00
pool_test.go sync: only check for successful PopHeads in long mode 2019-06-26 19:48:42 +00:00
pool.go sync: update comment 2019-04-19 16:15:36 +00:00
poolqueue.go sync: internal dynamically sized lock-free queue for sync.Pool 2019-04-05 18:49:04 +00:00
runtime_sema_test.go sync: allow inlining the Mutex.Unlock fast path 2019-03-05 14:59:31 +00:00
runtime.go sync: allow inlining the Mutex.Lock fast path 2019-03-09 05:08:04 +00:00
rwmutex_test.go
rwmutex.go sync: allow inlining the RWMutex.RUnlock fast path 2019-03-09 16:34:17 +00:00
waitgroup_test.go
waitgroup.go sync: allow inlining the Mutex.Unlock fast path 2019-03-05 14:59:31 +00:00