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)
| 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. |
| 20 | func (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. |