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

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.
主站蜘蛛池模板: 井研县| 东乌珠穆沁旗| 象州县| 元江| 高淳县| 建阳市| 东宁县| 翼城县| 甘肃省| 道孚县| 浏阳市| 新建县| 宁蒗| 洞口县| 龙岩市| 大荔县| 华宁县| 开化县| 温州市| 临潭县| 闽侯县| 剑川县| 淳安县| 株洲市| 个旧市| 崇文区| 东港市| 阳新县| 平遥县| 福州市| 石城县| 广东省| 文山县| 福建省| 芜湖市| 昌邑市| 乐山市| 唐河县| 泸定县| 双牌县| 乐平市|