mirror of
https://github.com/QuilibriumNetwork/ceremonyclient.git
synced 2026-02-21 18:37:26 +08:00
13 lines
308 B
Go
13 lines
308 B
Go
package cas
|
|
|
|
import "sync/atomic"
|
|
|
|
// IfLessThanInt64 sets the value of a to lt if the current value of a is less than lt.
|
|
func IfLessThanUint64(a *uint64, lt uint64) {
|
|
for val := atomic.LoadUint64(a); val < lt; val = atomic.LoadUint64(a) {
|
|
if atomic.CompareAndSwapUint64(a, val, lt) {
|
|
return
|
|
}
|
|
}
|
|
}
|