Roman Elizarov | b3d55a5 | 2017-02-03 12:47:21 +0300 | [diff] [blame^] | 1 | // This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit. |
| 2 | package guide.example15 |
Roman Elizarov | 7cf452e | 2017-01-29 21:58:33 +0300 | [diff] [blame] | 3 | |
| 4 | import kotlinx.coroutines.experimental.* |
| 5 | |
Roman Elizarov | 7deefb8 | 2017-01-31 10:33:17 +0300 | [diff] [blame] | 6 | fun main(args: Array<String>) = runBlocking<Unit> { |
Roman Elizarov | 7cf452e | 2017-01-29 21:58:33 +0300 | [diff] [blame] | 7 | val jobs = List(100_000) { // create a lot of coroutines and list their jobs |
Roman Elizarov | 7deefb8 | 2017-01-31 10:33:17 +0300 | [diff] [blame] | 8 | launch(CommonPool) { |
Roman Elizarov | 7cf452e | 2017-01-29 21:58:33 +0300 | [diff] [blame] | 9 | delay(1000L) |
| 10 | print(".") |
| 11 | } |
| 12 | } |
| 13 | jobs.forEach { it.join() } // wait for all jobs to complete |
| 14 | } |