Use mattermost v5 module (#1192)

This commit is contained in:
Wim
2020-08-10 00:29:54 +02:00
committed by GitHub
parent dfdffa0027
commit 4e50fd8649
608 changed files with 85280 additions and 25773 deletions

View File

@@ -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 {