• Dmitriy Vyukov's avatar
    sync/atomic: add Value · 98a1e207
    Dmitriy Vyukov authored
    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
    98a1e207
value_test.go 4.72 KB