theapache64
02/28/2022, 7:49 AMCoroutineScope(<http://Dispatchers.IO|Dispatchers.IO>).launch {
launch {
println("A")
delay(5000)
println("B")
}
launch(context = Job()) {
delay(1000)
throw IOException()
}
}
The above snippet will crash the android app (obviously), but the app prints B
5 seconds after the crash.
Note that removing Job()
gives expected result. Any idea why? š¤Sam
02/28/2022, 7:55 AMJob
breaks the structured concurrency hierarchy and unlinks the coroutine from its parent.theapache64
02/28/2022, 8:00 AM