atomic

Wrapper types for sync/atomic which enforce atomic access

  • 所有者: uber-go/atomic
  • 平台:
  • 許可證: MIT License
  • 分類:
  • 主題:
  • 喜歡:
    0
      比較:

Github星跟蹤圖

atomic GoDoc Build Status Coverage Status Go Report Card

Simple wrappers for primitive types to enforce atomic access.

Installation

$ go get -u go.uber.org/atomic@v1

Legacy Import Path

As of v1.5.0, the import path go.uber.org/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. go.uber.org/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.CAS(40, 11)

See the documentation for a complete API specification.

Development Status

Stable.


Released under the MIT License.

主要指標

概覽
名稱與所有者uber-go/atomic
主編程語言Go
編程語言Makefile (語言數: 2)
平台
許可證MIT License
所有者活动
創建於2016-05-24 00:12:01
推送於2025-04-14 21:33:18
最后一次提交2025-01-07 21:28:08
發布數15
最新版本名稱v1.11.0 (發布於 2023-05-03 14:21:18)
第一版名稱v1.0.0 (發布於 2016-07-18 13:41:41)
用户参与
星數1.4k
關注者數24
派生數109
提交數148
已啟用問題?
問題數38
打開的問題數8
拉請求數121
打開的拉請求數7
關閉的拉請求數40
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?