官术网_书友最值得收藏!

Job

A job is a fire-and-forget task. An operation that, once started, you will not be waiting on, unless, maybe, there's an exception. The most common way to create a job is to use the launch() coroutine builder, as shown:

fun main(args: Array<String>) = runBlocking {
val job = launch {
// Do background task here
}
}

However, you can also use the Job() factory function, like this:

fun main(args: Array<String>) = runBlocking {
val job = Job()
}
Job is an interface, and both launch() and Job() return the JobSupport  implementation, which is the basis of many implementations of Job. Deferred—which we will see as we move ahead is an interface that extends Job.
主站蜘蛛池模板: 洛南县| 临江市| 汶上县| 永丰县| 繁昌县| 六枝特区| 亳州市| 潼关县| 静乐县| 玉溪市| 年辖:市辖区| 泗阳县| 龙山县| 东兴市| 富宁县| 嘉禾县| 怀集县| 尉氏县| 伊宁县| 九江县| 山东| 衡水市| 界首市| 安溪县| 郸城县| 聊城市| 通城县| 库车县| 车致| 贵州省| 清涧县| 工布江达县| 宜丰县| 河南省| 大方县| 徐闻县| 滨海县| 辉南县| 中阳县| 乐昌市| 博客|