Standard library / sync/atomic
atomic.Uint32
A typed atomic uint32 with a usable zero value. Do not copy after first use. Prefer typed atomics to raw pointer functions for new code. Expected stdout: '0\n3\n'.
Formal Syntax & Structure
go syntaxgo
type Uint32 struct {}Working Example
Example Snippetgo
package main
import ( "fmt" "sync/atomic")
func main() { var x atomic.Uint32; fmt.Println(x.Load()); x.Add(3); fmt.Println(x.Load()) }