Код: Выделить всё
@Composable
fun CounterContentAtomicCheck(){
var counter by remember { mutableStateOf(0) }
Column(modifier = Modifier.padding(16.dp)) {
LaunchedEffect(Unit) {
launch {
repeat(100000) {
counter += 1
}
}
launch {
repeat(100000) {
counter += 1
}
}
}
Text(text = "Counter: $counter")
}
}
Можем ли мы сказать, что атомарность гарантирована?
Подробнее здесь: https://stackoverflow.com/questions/792 ... ate-atomic