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

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:

主站蜘蛛池模板: 忻州市| 天全县| 永平县| 基隆市| 铁岭县| 东丽区| 长子县| 辽源市| 海盐县| 吴堡县| 玉龙| 张家港市| 平陆县| 岑溪市| 肇州县| 岳阳县| 子长县| 汪清县| 石渠县| 二连浩特市| 简阳市| 通道| 锡林浩特市| 突泉县| 广元市| 吕梁市| 霍山县| 乌拉特中旗| 故城县| 永胜县| 岑溪市| 双牌县| 泾源县| 牟定县| 贡嘎县| 来凤县| 许昌市| 伊吾县| 石嘴山市| 德清县| 永平县|