Skip to content

Simple and easy wrappers for Go sync/atomic package.

License

Notifications You must be signed in to change notification settings

cristalhq/atomix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

atomix

build-img pkg-img version-img

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, int64
    • uint8, uint16, uint32, uint64`
    • float32, float64, complex64 and int
    • string, interface{} and error
    • uintptr, unsafe.Pointer
    • time.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.