PkgGoDev Build Status codecov Go Report Card LICENSE
Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms.
- Int8
- Int16
- Int32
- Int64
- Uint8
- Uint16
- Uint32
- Uint64
- Uintptr
- Pointer
- Float32
- Float64
- Bool
- String
- Bytes
- Value
go get github.com/hslam/atomic
import "github.com/hslam/atomic"
package main import ( "fmt" "github.com/hslam/atomic" ) func main() { str := atomic.NewString("") str.Store("Hi") str.Swap("Hello") str.Add(" atomic") str.CompareAndSwap("Hello atomic", "Hello World") fmt.Println(str.Load()) }
Hello World
This package is licensed under a MIT license (Copyright (c) 2020 Meng Huang)
atomic was written by Meng Huang.