atomix
atomix copied to clipboard
Simple and easy wrappers for Go sync/atomic package.
atomix
Better sync/atomic package for Go.
Rationale
To make life easier with sync/atomic this package provide wrappers and helper functions, so all the atomic data and operations are easily visible.
Note
For the better sync package see synx.
Features
- All primitive types and more
int8,int16,int32,int64uint8,uint16, uint32,uint64`float32,float64,complex64andintstring,interface{}anderroruintptr,unsafe.Pointertime.Time,time.Duration
- Zero cpu and memory overhead in almost all cases.
- Useful helpers.
See docs.
Install
go get github.com/cristalhq/atomix
Example
var a atomix.Int32
a.Store(1335)
a.Add(2)
b := a.Load() // 1337
License
MIT License.