You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Why is it written var counter = AtomicInteger()?
It seems to be val, because counter itself is not mutated, but the value of atomic does.
And this way we leave someone possibility to do counter = in an unsafe way.
And we can not make CI rule to warn of unsafe global mutable state.
On the other hand may be someone (who does not know what is Atomic*) needs to see, that counter has mutable meaning.
Why is it written
var counter = AtomicInteger()
?It seems to be
val
, because counter itself is not mutated, but the value of atomic does.And this way we leave someone possibility to do
counter =
in an unsafe way.And we can not make CI rule to warn of unsafe global mutable state.
On the other hand may be someone (who does not know what is Atomic*) needs to see, that counter has mutable meaning.
kotlinx.coroutines/kotlinx-coroutines-core/jvm/test/guide/example-sync-03.kt
Line 27 in 1eeed50
https://kotlinlang.org/docs/reference/coroutines/shared-mutable-state-and-concurrency.html
The text was updated successfully, but these errors were encountered: