property in the MutableStateFlow documentation say that it is thread-safe, when it clearly isn't (when e.g. concurrently increasing an integer value from multiple concurrent coroutines)
s
Sam
08/10/2022, 12:51 PM
By “thread safe” here they just mean that it won’t break when multiple threads use it at the same time.
Sam
08/10/2022, 12:52 PM
Incrementing a value really takes two operations; a read and then a write. “Thread-safe” just means that multiple threads can read and write the value concurrently. It doesn’t necessarily guarantee anything about the order that those reads and writes happen in.