Last active
March 25, 2024 19:13
-
-
Save ahinchman1/91130548e4b281252dba6561cc9ee5e3 to your computer and use it in GitHub Desktop.
runBlocking spins off 2 more runBlocking tasks
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 { | |
println("runBlocking main") | |
val task1 = runBlocking { | |
println(" task1") | |
// simulate a background task | |
delay(1000) | |
println(" task1: Done background task") | |
} | |
val task2 = runBlocking { | |
println(" task2") | |
// simulate a background task | |
delay(1000) | |
println(" task2: Done background task") | |
} | |
println("Program ends") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment