blob: 36a085752952e78fc5d6ce5fae7f7689d7eb2a28 [file] [log] [blame]
Roman Elizarovb3d55a52017-02-03 12:47:21 +03001// This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit.
2package guide.example15
Roman Elizarov7cf452e2017-01-29 21:58:33 +03003
4import kotlinx.coroutines.experimental.*
5
Roman Elizarov7deefb82017-01-31 10:33:17 +03006fun main(args: Array<String>) = runBlocking<Unit> {
Roman Elizarov7cf452e2017-01-29 21:58:33 +03007 val jobs = List(100_000) { // create a lot of coroutines and list their jobs
Roman Elizarov7deefb82017-01-31 10:33:17 +03008 launch(CommonPool) {
Roman Elizarov7cf452e2017-01-29 21:58:33 +03009 delay(1000L)
10 print(".")
11 }
12 }
13 jobs.forEach { it.join() } // wait for all jobs to complete
14}