Skip to content

Instantly share code, notes, and snippets.

@ahinchman1
Last active March 25, 2024 19:13
Show Gist options
  • Save ahinchman1/91130548e4b281252dba6561cc9ee5e3 to your computer and use it in GitHub Desktop.
Save ahinchman1/91130548e4b281252dba6561cc9ee5e3 to your computer and use it in GitHub Desktop.
runBlocking spins off 2 more runBlocking tasks
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