Created
August 30, 2021 05:38
-
-
Save khekrn/c5fdf1c7d2d75c601100d262c2083090 to your computer and use it in GitHub Desktop.
Coroutines are lightweight
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
import kotlinx.coroutines.* | |
//Start | |
fun main() = runBlocking { | |
repeat(100_00_00){ // launches one million coroutines | |
launch{ | |
delay(10000) // Wait for 10 Seconds | |
print(".") | |
} | |
} | |
} | |
//End |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment