MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / SetBoolAtomic

Method SetBoolAtomic

lib/sync/boolAm/boolAm.go:20–26  ·  view source on GitHub ↗

SetBoolAtomic sets the value of b. The operation is atomic and write the value atomically. If v is true, the value is set to 1. If v is false, the value is set to 0. The value of b is not guaranteed to be 1 or 0 if v is not true or false.

(v bool)

Source from the content-addressed store, hash-verified

18// If v is false, the value is set to 0.
19// The value of b is not guaranteed to be 1 or 0 if v is not true or false.
20func (b *Boolean) SetBoolAtomic(v bool) {
21 if v {
22 atomic.StoreUint32((*uint32)(b), 1)
23 } else {
24 atomic.StoreUint32((*uint32)(b), 0)
25 }
26}
27
28// GetBoolAtomic returns the value of b.
29// The operation is atomic and read the value atomically.

Callers 1

CloseMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected