Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import kotlinx.coroutines.delay
- import kotlinx.coroutines.launch
- import kotlinx.coroutines.runBlocking
- fun main(args: Array<String>) {
- runBlocking {
- repeat(1000, fun (i: Int): Unit {
- launch {
- var res = doSomething(i)
- print(res)
- }
- })
- }
- print("over...")
- }
- suspend fun doSomething(i: Int): Int {
- delay(100L)
- return i * 10
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement