forked from mirror/abool
Refine comments
This commit is contained in:
parent
ae078ebcf7
commit
0bc71b68c3
4
bool.go
4
bool.go
|
@ -40,7 +40,7 @@ func (ab *AtomicBool) IsSet() bool {
|
||||||
return atomic.LoadInt32((*int32)(ab)) == 1
|
return atomic.LoadInt32((*int32)(ab)) == 1
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetTo sets the boolean with given Boolean
|
// SetTo sets the Boolean with given Boolean.
|
||||||
func (ab *AtomicBool) SetTo(yes bool) {
|
func (ab *AtomicBool) SetTo(yes bool) {
|
||||||
if yes {
|
if yes {
|
||||||
atomic.StoreInt32((*int32)(ab), 1)
|
atomic.StoreInt32((*int32)(ab), 1)
|
||||||
|
@ -49,7 +49,7 @@ func (ab *AtomicBool) SetTo(yes bool) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flip flips the boolean value whether the value is set or not
|
// Flip toggles the Boolean (replaces with its opposite value).
|
||||||
func (ab *AtomicBool) Flip() {
|
func (ab *AtomicBool) Flip() {
|
||||||
atomic.StoreInt32((*int32)(ab), atomic.LoadInt32((*int32)(ab))^1)
|
atomic.StoreInt32((*int32)(ab), atomic.LoadInt32((*int32)(ab))^1)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue