aboutsummaryrefslogtreecommitdiff
path: root/src/sync
diff options
context:
space:
mode:
authorJes Cok <xigua67damn@gmail.com>2025-11-12 10:35:40 +0000
committerGopher Robot <gobot@golang.org>2025-11-12 10:03:52 -0800
commitc3d1d427648af99f88eec5ae9f4f55cc59874295 (patch)
treee9101bf772933c5ff11371f232bf1d0aa9a61671 /src/sync
parente0807ba470e6cfdc6dbc285a76216fab20cb0589 (diff)
downloadgo-c3d1d427648af99f88eec5ae9f4f55cc59874295.tar.xz
sync/atomic: amend comments for Value.{Swap,CompareAndSwap}
Related to CL 241661, CL 403094. Change-Id: I86877d9a013b05b1a97f9aa1333cd96ce98469cb GitHub-Last-Rev: 7fedca5848cb17730d4ccb586dc03cfcb1b83259 GitHub-Pull-Request: golang/go#76259 Reviewed-on: https://go-review.googlesource.com/c/go/+/719660 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Junyang Shao <shaojunyang@google.com>
Diffstat (limited to 'src/sync')
-rw-r--r--src/sync/atomic/value.go6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/sync/atomic/value.go b/src/sync/atomic/value.go
index 0cfc5f9496..031a9d5680 100644
--- a/src/sync/atomic/value.go
+++ b/src/sync/atomic/value.go
@@ -98,8 +98,7 @@ func (v *Value) Swap(new any) (old any) {
if typ == nil {
// Attempt to start first store.
// Disable preemption so that other goroutines can use
- // active spin wait to wait for completion; and so that
- // GC does not see the fake type accidentally.
+ // active spin wait to wait for completion.
runtime_procPin()
if !CompareAndSwapPointer(&vp.typ, nil, unsafe.Pointer(&firstStoreInProgress)) {
runtime_procUnpin()
@@ -150,8 +149,7 @@ func (v *Value) CompareAndSwap(old, new any) (swapped bool) {
}
// Attempt to start first store.
// Disable preemption so that other goroutines can use
- // active spin wait to wait for completion; and so that
- // GC does not see the fake type accidentally.
+ // active spin wait to wait for completion.
runtime_procPin()
if !CompareAndSwapPointer(&vp.typ, nil, unsafe.Pointer(&firstStoreInProgress)) {
runtime_procUnpin()