github.com/ooni/psiphon/tunnel-core@v0.0.0-20230105123940-fe12a24c96ee/oovendor/quic-go/internal/utils/atomic_bool.go (about) 1 package utils 2 3 import "sync/atomic" 4 5 // An AtomicBool is an atomic bool 6 type AtomicBool struct { 7 v int32 8 } 9 10 // Set sets the value 11 func (a *AtomicBool) Set(value bool) { 12 var n int32 13 if value { 14 n = 1 15 } 16 atomic.StoreInt32(&a.v, n) 17 } 18 19 // Get gets the value 20 func (a *AtomicBool) Get() bool { 21 return atomic.LoadInt32(&a.v) != 0 22 }