- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 90字
- 2021-08-05 10:46:52
New
As mentioned earlier, a job is, by default, started automatically both when it's created using launch() and when it's created using Job(). In order to create a job without starting it, you have to use CoroutineStart.LAZY when creating it. Consider the given example:
fun main(args: Array<String>) = runBlocking {
launch(start = CoroutineStart.LAZY) {
TODO("Not implemented yet!")
}
delay(500)
}
When running this snippet of code, you will note that it didn't print any errors. Since the job is created but never started, the exception will not be thrown:

推薦閱讀
- Unity 2020 By Example
- iOS Game Programming Cookbook
- Python爬蟲開發:從入門到實戰(微課版)
- Apache Spark 2 for Beginners
- Responsive Web Design with HTML5 and CSS3
- WordPress 4.0 Site Blueprints(Second Edition)
- C#實踐教程(第2版)
- jQuery for Designers Beginner's Guide Second Edition
- JSP程序設計與案例實戰(慕課版)
- NGUI for Unity
- Mastering Node.js
- Go語言編程之旅:一起用Go做項目
- Learning RSLogix 5000 Programming
- C語言程序設計教程
- 青少年編程魔法課堂:Python圖形化創意編程