Standard library / sync/atomic

atomic.Bool.Load()

Read the current boolean atomically. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (x *Bool) Load() bool

Return Value

bool

Current boolean.

Working Example

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