TheMrCodes
03/30/2021, 10:12 AMMutableStateFlow
Tijl
03/30/2021, 10:19 AMMutableStateFlow.value =
if it’s for during a longer time (e.g. a block) Mutex
(from coroutines), but if not the above is much simpelerHitender Pannu
03/30/2021, 10:20 AMTijl
03/30/2021, 10:21 AMTijl
03/30/2021, 10:22 AMHitender Pannu
03/30/2021, 10:28 AMwasyl
03/30/2021, 10:36 AMHitender Pannu
03/30/2021, 10:37 AMwasyl
03/30/2021, 10:39 AMwasyl
03/30/2021, 10:39 AMJilles van Gurp
03/30/2021, 10:52 AMmutex.withLock {...}
That will make it thread safe and thus safe against coRoutines running on different threads as well. For single threaded uses, you should not need this.TheMrCodes
03/30/2021, 11:22 AMMutableStateFlow
it's not marked as @ObsoleteCoroutinesApi
and does the thing I needed.
Also I looked into it Mutex and it seems to be far to low level for my usecase.
Thanks guys 👍