| // This file was automatically generated from coroutines-guide.md by Knit tool. Do not edit. |
| package guide.basic.example01 |
| |
| import kotlinx.coroutines.experimental.* |
| |
| fun main(args: Array<String>) { |
| launch(CommonPool) { // create new coroutine in common thread pool |
| delay(1000L) // non-blocking delay for 1 second (default time unit is ms) |
| println("World!") // print after delay |
| } |
| println("Hello,") // main function continues while coroutine is delayed |
| Thread.sleep(2000L) // block main thread for 2 seconds to keep JVM alive |
| } |