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

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.
主站蜘蛛池模板: 会泽县| 油尖旺区| 海阳市| 新建县| 松江区| 和田市| 七台河市| 神农架林区| 金寨县| 富民县| 乌兰县| 克什克腾旗| 余庆县| 凤翔县| 五峰| 赤城县| 神农架林区| 宁南县| 延川县| 徐汇区| 青冈县| 大安市| 正蓝旗| 含山县| 伊通| 囊谦县| 绥阳县| 商河县| 修水县| 宁化县| 阳城县| 吴堡县| 南乐县| 图片| 屏东市| 罗江县| 民权县| 宝坻区| 信宜市| 平泉县| 焦作市|