mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-04 16:42:37 +08:00
Fix atomic value updating
This commit is contained in:
parent
27aff26bfd
commit
4564531f8b
@ -182,7 +182,7 @@ internal inline fun AtomicLong.updateWhen(condition: (Long) -> Boolean, update:
|
|||||||
while (true) {
|
while (true) {
|
||||||
val current = value
|
val current = value
|
||||||
if (condition(current)) {
|
if (condition(current)) {
|
||||||
if (compareAndSet(0, update(current))) {
|
if (compareAndSet(current, update(current))) {
|
||||||
return true
|
return true
|
||||||
} else continue
|
} else continue
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user