• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H29-Oct-2019-

.codecov.ymlH A D29-Oct-2019763

.gitignoreH A D29-Oct-201999

.travis.ymlH A D29-Oct-2019348

CHANGELOG.mdH A D29-Oct-20191.7 KiB

MakefileH A D29-Oct-2019664

README.mdH A D29-Oct-20191.6 KiB

atomic.goH A D29-Oct-20199.2 KiB

atomic_test.goH A D29-Oct-20196.6 KiB

error.goH A D29-Oct-20191.9 KiB

error_test.goH A D29-Oct-20191.9 KiB

example_test.goH A D29-Oct-20191.4 KiB

go.modH A D29-Oct-2019252

go.sumH A D29-Oct-20192.1 KiB

stress_test.goH A D29-Oct-20195.5 KiB

string.goH A D29-Oct-20191.7 KiB

string_test.goH A D29-Oct-20191.6 KiB

tools.goH A D29-Oct-20191.2 KiB

README.md

1# atomic [![GoDoc][doc-img]][doc] [![Build Status][ci-img]][ci] [![Coverage Status][cov-img]][cov] [![Go Report Card][reportcard-img]][reportcard]
2
3Simple wrappers for primitive types to enforce atomic access.
4
5## Installation
6
7```shell
8$ go get -u go.uber.org/atomic@v1
9```
10
11Note: If you are using Go modules, this package will fail to compile with the
12import path `github.com/uber-go/atomic`. To continue using that import path,
13you will have to add a `replace` directive to your `go.mod`, replacing
14`github.com/uber-go/atomic` with `go.uber.org/atomic`.
15
16```shell
17$ go mod edit -replace github.com/uber-go/atomic=go.uber.org/atomic@v1
18```
19
20## Usage
21
22The standard library's `sync/atomic` is powerful, but it's easy to forget which
23variables must be accessed atomically. `go.uber.org/atomic` preserves all the
24functionality of the standard library, but wraps the primitive types to
25provide a safer, more convenient API.
26
27```go
28var atom atomic.Uint32
29atom.Store(42)
30atom.Sub(2)
31atom.CAS(40, 11)
32```
33
34See the [documentation][doc] for a complete API specification.
35
36## Development Status
37
38Stable.
39
40---
41
42Released under the [MIT License](LICENSE.txt).
43
44[doc-img]: https://godoc.org/github.com/uber-go/atomic?status.svg
45[doc]: https://godoc.org/go.uber.org/atomic
46[ci-img]: https://travis-ci.com/uber-go/atomic.svg?branch=master
47[ci]: https://travis-ci.com/uber-go/atomic
48[cov-img]: https://codecov.io/gh/uber-go/atomic/branch/master/graph/badge.svg
49[cov]: https://codecov.io/gh/uber-go/atomic
50[reportcard-img]: https://goreportcard.com/badge/go.uber.org/atomic
51[reportcard]: https://goreportcard.com/report/go.uber.org/atomic
52