Files
next.orly.dev/pkg/utils/atomic/README.md
2025-09-02 20:32:53 +01:00

685 B

atomic

Simple wrappers for primitive types to enforce atomic access.

Installation

$ go get -u github.com/mleku/nodl/pkg/atomic@latest

Usage

The standard library's sync/atomic is powerful, but it's easy to forget which variables must be accessed atomically. github.com/mleku/nodl/pkg/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.CompareAndSwap(40, 11)

See the [documentation][doc] for a complete API specification.

Development Status

Stable.


Released under the MIT License.