Update split SDK to 6.0.2 to fix sync bug (#17060)
* Update split SDK to 6.0.2 to fix sync bug * Vendor and tidy
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
fa2ecad0a9
Коммит
aba00a3cfd
41
vendor/github.com/splitio/go-toolkit/v4/sync/atomicbool.go
сгенерированный
поставляемый
Обычный файл
41
vendor/github.com/splitio/go-toolkit/v4/sync/atomicbool.go
сгенерированный
поставляемый
Обычный файл
@@ -0,0 +1,41 @@
|
||||
package sync
|
||||
|
||||
import (
|
||||
"sync/atomic"
|
||||
)
|
||||
|
||||
const (
|
||||
falseValue = 0
|
||||
trueValue = 1
|
||||
)
|
||||
|
||||
type AtomicBool struct {
|
||||
value uint32
|
||||
}
|
||||
|
||||
func (b *AtomicBool) Set() {
|
||||
atomic.StoreUint32(&b.value, trueValue)
|
||||
}
|
||||
|
||||
func (b *AtomicBool) Unset() {
|
||||
atomic.StoreUint32(&b.value, falseValue)
|
||||
}
|
||||
|
||||
func (b *AtomicBool) IsSet() bool {
|
||||
return atomic.LoadUint32(&b.value) == trueValue
|
||||
}
|
||||
|
||||
func (b *AtomicBool) TestAndSet() bool {
|
||||
return atomic.CompareAndSwapUint32(&b.value, falseValue, trueValue)
|
||||
}
|
||||
|
||||
func (b *AtomicBool) TestAndClear() bool {
|
||||
return atomic.CompareAndSwapUint32(&b.value, trueValue, falseValue)
|
||||
}
|
||||
|
||||
func NewAtomicBool(initialValue bool) *AtomicBool {
|
||||
if initialValue {
|
||||
return &AtomicBool{value: trueValue}
|
||||
}
|
||||
return &AtomicBool{}
|
||||
}
|
||||
Ссылка в новой задаче
Block a user