https://kotlinlang.org logo
#compose
Title
# compose
k

Kyant

02/11/2021, 1:46 AM
I use
mutableStateListOf().parallelStream().forEach {}
and coroutines to execute the items in parallel, but it seems some executions won't be run. And the missing executions are random. Is there a solution?
a

Adam Powell

02/11/2021, 1:59 AM
What more specifically are you trying to do?
k

Kyant

02/11/2021, 3:20 AM
I try to load images, and then pass it to Image()
As you can see, some images won't be displayed
a

Adam Powell

02/11/2021, 4:06 AM
Can you post the code surrounding that snippet?
k

Kyant

02/11/2021, 4:07 AM
Yeah, wait a minute
I load songs without icons at first, then copy icons to every song.
Emmm, the result is "30 : 29 : 29"
z

Zach Klippenstein (he/him) [MOD]

02/11/2021, 3:25 PM
The biggest red flag here is that you’re using mutable state in multiple threads, which is likely to cause weird data inconsistency bugs like you’ve described.
k

Kyant

02/11/2021, 11:47 PM
What should I do? Use Kotlin Flow?
4 Views