Can someone explain me what's happening here? :thr...
# coroutines
k
Can someone explain me what's happening here? 🧵 Thank you!
Scenario 1 - When the exception happens in the first coroutine i.e Job1, does it also cancel the scope ? The
join
will make sure that execution is sequential, therefore, understood that job2 coroutine should be executed after job1 completes. but it does not even launch a coroutine
Scenario 2 - In this scenario, if I remove the join and make this parallel execution., the exception is not printed at all. why is that?
p
1 - A failure of the child cancels the parent scope (if not supervisor), yes. So this scope can’t be used anymore to launch new coroutines — it’s cancelled. 2 - Probably
main
finishes before throwing the exception, since it’s not under structured concurrency (
myScope
is not a child of the `runBlocking`scope).
👍 1
k
1. yes that makes sense! thanks
2. hmmm, yea looks like main finishes, before the coroutine has completed.