github.com/hslam/atomic@v1.0.0/README.md (about) 1 # atomic 2 [](https://pkg.go.dev/github.com/hslam/atomic) 3 [](https://github.com/hslam/atomic/actions) 4 [](https://codecov.io/gh/hslam/atomic) 5 [](https://goreportcard.com/report/github.com/hslam/atomic) 6 [](https://github.com/hslam/atomic/blob/master/LICENSE) 7 8 Package atomic provides low-level atomic memory primitives useful for implementing synchronization algorithms. 9 10 ## Feature 11 * Int8 12 * Int16 13 * Int32 14 * Int64 15 * Uint8 16 * Uint16 17 * Uint32 18 * Uint64 19 * Uintptr 20 * Pointer 21 * Float32 22 * Float64 23 * Bool 24 * String 25 * Bytes 26 * Value 27 28 ## Get started 29 30 ### Install 31 ``` 32 go get github.com/hslam/atomic 33 ``` 34 ### Import 35 ``` 36 import "github.com/hslam/atomic" 37 ``` 38 ### Usage 39 #### Example 40 ```go 41 package main 42 43 import ( 44 "fmt" 45 "github.com/hslam/atomic" 46 ) 47 48 func main() { 49 str := atomic.NewString("") 50 str.Store("Hi") 51 str.Swap("Hello") 52 str.Add(" atomic") 53 str.CompareAndSwap("Hello atomic", "Hello World") 54 fmt.Println(str.Load()) 55 } 56 ``` 57 58 ### Output 59 ``` 60 Hello World 61 ``` 62 63 ### License 64 This package is licensed under a MIT license (Copyright (c) 2020 Meng Huang) 65 66 ### Author 67 atomic was written by Meng Huang.