Last active
June 14, 2022 19:18
-
-
Save MasoudFallahpour/cf8af7c1d70feb62dd560036e7508cc4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fun main() = runBlocking { | |
val job = launch(CoroutineName("parent")) { | |
launch { | |
delay(2000) | |
println("coroutine1: I'm done") | |
} | |
launch { | |
delay(3000) | |
println("coroutine2: I'm done") | |
} | |
} | |
println("Cancelling the parent coroutine...") | |
job.cancelAndJoin() | |
println("Parent coroutine cancelled") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment