mleku 359bf54565
Some checks failed
FOSSA Analysis / build (push) Has been cancelled
Go / build (1.17.x) (push) Has been cancelled
Go / build (1.18.x) (push) Has been cancelled
Go / build (1.19.x, true) (push) Has been cancelled
changing urls again
2023-11-27 13:47:17 +00:00
2023-11-24 10:40:32 +00:00
2023-11-24 10:40:32 +00:00
2023-05-03 14:32:19 -07:00
2020-05-15 15:47:25 -07:00
2023-11-27 13:47:17 +00:00
2021-06-11 08:23:41 -07:00
2023-11-27 13:47:17 +00:00
2023-11-27 13:47:17 +00:00
2023-11-24 10:40:32 +00:00
2022-08-05 09:14:45 -07:00
2022-08-09 16:56:14 -07:00
2023-11-24 10:40:32 +00:00
2021-06-22 00:36:49 -07:00
2021-06-22 00:36:49 -07:00
2021-06-22 00:36:49 -07:00

atomic GoDoc Build Status Coverage Status Go Report Card

Simple wrappers for primitive types to enforce atomic access.

Installation

$ go get -u github.com/p9ds/atomic@v1

Legacy Import Path

As of v1.5.0, the import path github.com/p9ds/atomic is the only supported way of using this package. If you are using Go modules, this package will fail to compile with the legacy import path path github.com/uber-go/atomic.

We recommend migrating your code to the new import path but if you're unable to do so, or if your dependencies are still using the old import path, you will have to add a replace directive to your go.mod file downgrading the legacy import path to an older version.

replace github.com/uber-go/atomic => github.com/uber-go/atomic v1.4.0

You can do so automatically by running the following command.

$ go mod edit -replace github.com/uber-go/atomic=github.com/uber-go/atomic@v1.4.0

Usage

The standard library's sync/atomic is powerful, but it's easy to forget which variables must be accessed atomically. github.com/p9ds/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 for a complete API specification.

Development Status

Stable.


Released under the MIT License.

Description
atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard]
Readme 235 KiB
Languages
Go 97.9%
Makefile 2.1%