forked from lug/matterbridge
Use mattermost v5 module (#1192)
This commit is contained in:
9
vendor/go.uber.org/atomic/atomic.go
generated
vendored
9
vendor/go.uber.org/atomic/atomic.go
generated
vendored
@@ -250,11 +250,16 @@ func (b *Bool) Swap(new bool) bool {
|
||||
|
||||
// Toggle atomically negates the Boolean and returns the previous value.
|
||||
func (b *Bool) Toggle() bool {
|
||||
return truthy(atomic.AddUint32(&b.v, 1) - 1)
|
||||
for {
|
||||
old := b.Load()
|
||||
if b.CAS(old, !old) {
|
||||
return old
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func truthy(n uint32) bool {
|
||||
return n&1 == 1
|
||||
return n == 1
|
||||
}
|
||||
|
||||
func boolToInt(b bool) uint32 {
|
||||
|
||||
Reference in New Issue
Block a user