We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 806daf6 commit 513bad1Copy full SHA for 513bad1
stately-concurrency/src/jsWasmMain/kotlin/co/touchlab/stately/concurrency/AtomicInt.kt
@@ -23,8 +23,9 @@ actual class AtomicInt actual constructor(initialValue: Int) {
23
private var internalValue: Int = initialValue
24
25
actual fun addAndGet(delta: Int): Int {
26
- internalValue += delta
27
- return internalValue
+ return (internalValue + delta).also {
+ internalValue = it
28
+ }
29
}
30
31
actual fun compareAndSet(expected: Int, new: Int): Boolean {
0 commit comments