https://github.com/cristalhq/atomix
Simple and easy wrappers for Go sync/atomic package.
https://github.com/cristalhq/atomix
atomic concurrency dependency-free go golang wrapper
Last synced: about 1 year ago
JSON representation
Simple and easy wrappers for Go sync/atomic package.
- Host: GitHub
- URL: https://github.com/cristalhq/atomix
- Owner: cristalhq
- License: mit
- Created: 2019-03-31T12:05:26.000Z (about 7 years ago)
- Default Branch: main
- Last Pushed: 2024-03-03T13:43:30.000Z (over 2 years ago)
- Last Synced: 2025-03-23T03:24:49.853Z (over 1 year ago)
- Topics: atomic, concurrency, dependency-free, go, golang, wrapper
- Language: Go
- Homepage:
- Size: 62.5 KB
- Stars: 31
- Watchers: 2
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# atomix
[![build-img]][build-url]
[![pkg-img]][pkg-url]
[![version-img]][version-url]
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](https://github.com/cristalhq/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][pkg-url].
## Install
```
go get github.com/cristalhq/atomix
```
## Example
```go
var a atomix.Int32
a.Store(1335)
a.Add(2)
b := a.Load() // 1337
```
## License
[MIT License](LICENSE).
[build-img]: https://github.com/cristalhq/atomix/workflows/build/badge.svg
[build-url]: https://github.com/cristalhq/atomix/actions
[pkg-img]: https://pkg.go.dev/badge/cristalhq/atomix
[pkg-url]: https://pkg.go.dev/github.com/cristalhq/atomix
[version-img]: https://img.shields.io/github/v/release/cristalhq/acmd
[version-url]: https://github.com/cristalhq/acmd/releases