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

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:

主站蜘蛛池模板: 邵武市| 扎囊县| 饶平县| 南投市| 临漳县| 沁源县| 汉沽区| 武胜县| 泸溪县| 徐闻县| 扎鲁特旗| 墨江| 垦利县| 原平市| 阳朔县| 天镇县| 牟定县| 乌拉特后旗| 大连市| 红河县| 怀来县| 长垣县| 榕江县| 论坛| 长宁区| 荔波县| 美姑县| 曲麻莱县| 正镶白旗| 淮北市| 南安市| 华阴市| 巨鹿县| 临漳县| 玛多县| 宣威市| 洞口县| 卢龙县| 陆良县| 芜湖市| 屏东县|