commit | 54e9e20165431ae155d56ca42d406b7a69fa7192 | [log] [tgz] |
---|---|---|
author | Prashant Varanasi <github@prashantv.com> | Tue Nov 14 11:42:34 2017 -0800 |
committer | GitHub <noreply@github.com> | Tue Nov 14 11:42:34 2017 -0800 |
tree | cd024e7d7ea0ebdb0242fdfc14fa3fbd27b6ebe6 | |
parent | 0ee2c2d99502f0a552d9b2ee98f1f97fed196d48 [diff] |
Add parallel benchmarks (#34) Atomic operations tend to be fast when there's no contention but get a lot slower with contention, so add tests which run the same stress test in parallel.
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.