Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import kotlinx.coroutines.delay
import java.lang.Thread.sleep
fun main() {
val a = GlobalScope.async { throw RuntimeException() }
val b = GlobalScope.async { delay(2000).also { println("I leaked!") } } // Will not be printed!
println(a)
println(b)
sleep(2500)
println(a)
println(b)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment