]> Cypherpunks.ru repositories - gostls13.git/commit
sync/atomic: add typed atomic values
authorRuss Cox <rsc@golang.org>
Wed, 26 Jan 2022 21:56:00 +0000 (16:56 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 4 May 2022 18:05:18 +0000 (18:05 +0000)
commitffe48e00adf3078944015186819a1ed5c6aa8bec
tree5cb6825842606fe62d88fc8a21ea8633dce01bb3
parentcf697253abb781e8a3e8825b7a4b5b96a534b907
sync/atomic: add typed atomic values

These implementations will inline to the lower-level primitives,
but they hide the underlying values so that all accesses are
forced to use the atomic APIs. They also allow the use of shorter
names (methods instead of functions) at call sites, making code
more readable.

Pointer[T] also avoids conversions using unsafe.Pointer at call sites.

Discussed on #47141.
See also https://research.swtch.com/gomm for background.

Fixes #50860.

Change-Id: I0b178ee0c7747fa8985f8e48cd7b01063feb7dcc
Reviewed-on: https://go-review.googlesource.com/c/go/+/381317
Reviewed-by: Michael Pratt <mpratt@google.com>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gopher Robot <gobot@golang.org>
api/next/50860.txt [new file with mode: 0644]
src/cmd/compile/internal/test/inl_test.go
src/cmd/compile/internal/types/size.go
src/sync/atomic/atomic_test.go
src/sync/atomic/type.go [new file with mode: 0644]