uhe
10/25/2018, 12:54 PMval job = SupervisorJob()
val deferred = CompletableDeferred<Unit>()
GlobalScope.launch(job, start = UNDISPATCHED) {
try {
deferred.await()
println("after await!")
} catch (e: CancellationException) {
throw e
} catch (e: Exception) {
println("exception during await(): ${e.message}")
}
}
job.cancelChildren()
runBlocking { job.children.forEach { it.join() } }
deferred.cancel(IllegalArgumentException())
Given that deferred.cancel() is done in a library that I can't change, what do I have to change in order for this code to not crash my program?