Standard library / sync/atomic
atomic.Uint64.Load()
Atomically read the current value. Use atomic access consistently for a concurrently shared location. Expected stdout: '12\n12\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Uint64) Load() uint64Return Value
uint64
Current value.
Working Example
Example Snippetgo
package main
import ( "fmt" "sync/atomic")
func main() { var x atomic.Uint64; x.Store(12); fmt.Println(x.Load()); fmt.Println(x.Load()) }