commit | 7afff28c37d544582bcf088ab443a62f590dfe6b | [log] [tgz] |
---|---|---|
author | Akshay Shah <akshay@akshayshah.org> | Mon May 30 11:10:24 2016 -0700 |
committer | Akshay Shah <akshay@akshayshah.org> | Mon May 30 11:10:24 2016 -0700 |
tree | 913594e805943fed983a144bc28b8aa80ed95938 | |
parent | e1b75a466a74d5373afd99fe1655b9426a8231b2 [diff] |
Add an atomic Boolean type (#4) * Add an atomic Boolean type Fixes #2. * Feedback from CR - Rename Swap to Toggle - Add a more Swap-like Swap * Add boolToInt helper
Simple numeric wrappers to enforce atomic access.
go get -u github.com/uber-go/atomic
The standard library‘s sync/atomic
is powerful, but it’s easy to forget which variables must be accessed atomically. uber-go/atomic
preserves all the functionality of the standard library, but wraps the primitive numeric 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.