Skip to content

Instantly share code, notes, and snippets.

@jaozinfs
Created June 7, 2022 19:53
Show Gist options
  • Save jaozinfs/f44f8cf322f4e26154f54b970c1b4983 to your computer and use it in GitHub Desktop.
Save jaozinfs/f44f8cf322f4e26154f54b970c1b4983 to your computer and use it in GitHub Desktop.
fun main() = runBlocking {
val job = launch {
launch {
downloadImage()
}
launch {
downloadSounds()
}
println("finish downloads")
}
job.join()
println("Finish Job")
}
suspend fun downloadImage(){
(1..2).onEach {
delay(300)
println("image $it")
}
}
suspend fun downloadSounds() {
(1..2).onEach {
delay(300)
println("sound $it")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment