Mejdi
10/08/2021, 9:00 PMSharedFlow
on iOS, do we need to use the -native-mt
version of kotlinx coroutines ? Same goes with the Mutex
APIs. Both don’t seem to work using the core version of it. I want to verify this before setting any conclusion.
In the docs we set the common
label against them, would that mean that these are supported in all platforms ?darkmoon_uk
10/09/2021, 12:14 AMSharedFlow
itself can work, in general, I found there are definitely Flow
operators and combinations of them that are incompatible with the 'freezing' memory model in iOS, regardless of whether you use -mt
or not.
I feel it's a bit of a dirty secret that Flows library does not work properly on iOS even if you are careful not to cross thread boundaries in your own code, because internal Coroutines machinery sometimes does so itself, in ways that aren't explicitly documented, causing freezing issues.
I found it usable, but I needed to be very selective and experimental about use of Channels
, channelFlow
etc. to avoid issues.
Thankfully JB decided to implement the new memory model - I wouldn't be surprised if the Flow library issues were a major contributor to that decision. Probably easier than trying to rearchitect the library to work with both models.
Maybe you could start trying to use that?Mejdi
10/09/2021, 12:40 AMMejdi
10/09/2021, 12:45 AM