Standard library / sync/atomic
atomic.Bool.Store()
Set the boolean atomically. Expected stdout: 'true\n'.
Formal Syntax & Structure
go syntaxgo
func (x *Bool) Store(val bool)Parameters & Attributes
| Name | Type | Description |
|---|---|---|
| val | bool | Value to store; context values should be request-scoped. |
Working Example
Example Snippetgo
package main
import ( "fmt" "sync/atomic")
func main() { var x atomic.Bool; x.Store(true); fmt.Println(x.Load()) }