commit | 1ea20fb1cbb1cc08cbd0d913a96dead89aa18289 | [log] [tgz] |
---|---|---|
author | Nathan Jordan <natedagreat27274@gmail.com> | Tue May 01 10:38:09 2018 -0700 |
committer | GitHub <noreply@github.com> | Tue May 01 10:38:09 2018 -0700 |
tree | bcb68c16491d1a51b71826ee38f4aef07fe32e9f | |
parent | 8474b86a5a6f79c443ce4b2992817ff32cf208b8 [diff] |
add atomic duration type (#37) wrapper around existing `Int64` type for atomic operations on `time.Duration` values
Simple wrappers for primitive types to enforce atomic access.
go get -u go.uber.org/atomic
The standard library‘s sync/atomic
is powerful, but it’s easy to forget which variables must be accessed atomically. go.uber.org/atomic
preserves all the functionality of the standard library, but wraps the primitive types to provide a safer, more convenient API.
var atom atomic.Uint32
atom.Store(42)
atom.Sub(2)
atom.CAS(40, 11)
See the documentation for a complete API specification.
Stable.