leandro
09/05/2023, 8:12 AMrunBlocking
, are there other deep dives and advanced explanations of it?CLOVIS
09/05/2023, 9:26 AMRobert Williams
09/05/2023, 9:26 AMRobert Williams
09/05/2023, 9:27 AMRobert Williams
09/05/2023, 9:31 AMCLOVIS
09/05/2023, 9:34 AMthere's nothing special or specially bad about it other than the fact that it's a blocking methodThat's true, but in the real world if you see two suspending functions that call each other, you expect them to behave as structured concurrency describes. If there's a
runBlocking
between them though, they won't, and it's not always easy to find where it is.
I agree that it's exactly the same issue, but it's much harder to debug because you won't see it comingCLOVIS
09/05/2023, 9:35 AMrunInterruptible
example. It's really a hack, it shouldn't really appear in real codebases.Robert Williams
09/05/2023, 9:57 AMRobert Williams
09/05/2023, 10:01 AMwithContext
for)simon.vergauwen
09/05/2023, 10:22 AMrunInterruptible
though, but not sure about Android.
When building JVM applications, or servers, I've had to interact with some older Java SDKs from time to time and using runInterruptible
in those cases is absolutely fine IMO.simon.vergauwen
09/05/2023, 10:23 AMrunInterruptible
with the right dispatcher thoughCLOVIS
09/05/2023, 10:23 AMrunInterruptible { Thread.sleep() }
is definitely not a good ideaStylianos Gakis
09/05/2023, 7:07 PMIt’s important to callAnd what would that be? I don’t think I’ve heard about this beforewith the right dispatcher thoughrunInterruptible
Stylianos Gakis
09/05/2023, 7:15 PMCLOVIS
09/05/2023, 7:16 PMIO
, since that's the only one made specifically to handle blocking callsCLOVIS
09/05/2023, 7:17 PMrunInterruptible(Dispatchers.Main) { … }