Documentation of SharedFlow says: `All methods of...
# coroutines
t
Documentation of SharedFlow says:
All methods of shared flow are *thread-safe* and can be safely invoked from concurrent coroutines without external synchronization.
But IDE on SharedFlow.emit says:
Collects the value emitted by the upstream. This method is not thread-safe and should not be invoked concurrently.
Which one is right?
e
The first one is right. We really need to override the docs on
SharedFlow.emit
t
Thanks that's what I supposed but better to be sure.
e
t
Since you are here sorry to ask but can you confirm that https://github.com/Kotlin/kotlinx.coroutines/pull/2377 was only an issue when there was already a ongoing unhandled exception but else 1.4.1 is safe to use?
e
I really don't know. I did not have time to create a proper test, so it is all kind of tentative. I would be grad if you can minimize a problem and turn into a self-contained test, then we can really verify that this PR fixes it.
(without a test I can only say that it definitely does not harm)
t
I tried a lot to reproduce but was unable 😞 All I know is that with 1.3.9 and tons of DAU I see about 1 or 2 times per week an coroutine internal machinery error with the code reported at https://github.com/Kotlin/kotlinx.coroutines/issues/2371#issuecomment-725927734