Standard library / sync/atomic

atomic.Uintptr.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 *Uintptr) Load() uintptr

Return Value

uintptr

Current value.

Working Example

Example Snippetgo
package main
import (  "fmt"  "sync/atomic")
func main() { var x atomic.Uintptr; x.Store(12); fmt.Println(x.Load()); fmt.Println(x.Load()) }
Go Reference