- Learning Concurrency in Kotlin
- Miguel Angel Castiblanco Torres
- 181字
- 2021-08-05 10:46:51
Life cycle
Here's a diagram showing the life cycle of a job:

By default, a job is started as soon as it's created. This happens both when the job is created with launch() and when it's done with Job(). As we will see in a bit, it's possible to create a job without starting it.
There are five states in the diagram:
- New: A job that exists but is not executing yet.
- Active: A job that is running. A suspended job is also considered active.
- Completed: When the job is not executing any longer.
- Cancelling: When cancel() is called on a Job that is active, it may require time for the cancellation to complete. This is an intermediate state between Active and Cancelled.
- Cancelled: A job that has completed its execution due to cancellation. Note that a Cancelled job can be considered Completed too.
Note that if cancel() is called in a job in the New state, it will not go through the Cancelling state. It will directly go to Cancelled .
推薦閱讀
- 少兒人工智能趣味入門:Scratch 3.0動畫與游戲編程
- Mastering JavaScript Object-Oriented Programming
- Android開發(fā)精要
- JavaScript 網(wǎng)頁編程從入門到精通 (清華社"視頻大講堂"大系·網(wǎng)絡開發(fā)視頻大講堂)
- Getting Started with PowerShell
- Instant Typeahead.js
- Java程序設計入門
- 精通Python自動化編程
- Lighttpd源碼分析
- TMS320LF240x芯片原理、設計及應用
- Cocos2d-x Game Development Blueprints
- Fastdata Processing with Spark
- 跟戴銘學iOS編程:理順核心知識點
- INSTANT PLC Programming with RSLogix 5000
- Ubuntu Server Cookbook