Skip to content

Instantly share code, notes, and snippets.

@ahinchman1
Last active March 25, 2024 19:17
Show Gist options
  • Save ahinchman1/d16629f607bfd740378568d513a8c6ee to your computer and use it in GitHub Desktop.
Save ahinchman1/d16629f607bfd740378568d513a8c6ee to your computer and use it in GitHub Desktop.
fun main() = runBlocking {
println("runBlocking main")
val scope = CoroutineScope(Job())
println("scope created. Create job...")
val job = scope.launch {
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