]> Cypherpunks repositories - gostls13.git/commit
sync/atomic: add Value
authorDmitriy Vyukov <dvyukov@google.com>
Wed, 17 Sep 2014 02:54:26 +0000 (19:54 -0700)
committerDmitriy Vyukov <dvyukov@google.com>
Wed, 17 Sep 2014 02:54:26 +0000 (19:54 -0700)
commit98a1e207e29359dba86769877021838bb77b12c3
tree5df8a05ccdcacf030010d1414c08e7142eba510f
parentcbf97d9103b2bbfb8c798f06c751e74093062b57
sync/atomic: add Value
A Value provides an atomic load and store of a consistently typed value.
It's intended to be used with copy-on-write idiom (see the example).

Performance:
BenchmarkValueRead 50000000         21.7 ns/op
BenchmarkValueRead-2 200000000          8.63 ns/op
BenchmarkValueRead-4 300000000          4.33 ns/op

TBR=rsc
R=golang-codereviews
CC=golang-codereviews
https://golang.org/cl/136710045
src/runtime/thunk.s
src/sync/atomic/norace.go [new file with mode: 0644]
src/sync/atomic/race.go [new file with mode: 0644]
src/sync/atomic/value.go [new file with mode: 0644]
src/sync/atomic/value_test.go [new file with mode: 0644]