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.