当前位置:网站首页>Kotlin - coroutinebuilder
Kotlin - coroutinebuilder
2022-07-26 20:46:00 【A lazy programmer】
CoroutineBuilder
Pending functions need to be passed to each other Continuation, Each pending function is called by another pending function , All this starts with the collaboration builder . Every coroutine constructor is CoroutineScope The extension function of , And inherited its coutineContext To automatically propagate its context elements and cancellability .
- lunch(): There is no need to generate values . Return to one Job example Used to manage the life cycle of the collaborative process . abnormal ???
- async(): Need to generate value . Return to one Deferred example adopt await() Get the results of the execution ( Including exceptions ). abnormal ???
Parameters context: Specify the collaboration context . Parameters start: Specify the startup mode of the collaboration , The default is the state that can be dispatched immediately . Parameters block: Co process actuator , That is, the task to be done . | |
| lunch() | public fun CoroutineScope.launch( Return the reference to the collaboration task , namely Job Anonymous implementation of interface . |
| async() | public fun <T> CoroutineScope.async( Return the execution result of the collaboration , adopt await() You can get the execution result of the cooperation process . |
边栏推荐
- How to implement an asynchronous task queue system that can handle massive data (supreme Collection Edition)
- Pandonia spirit voxedit creation competition
- Numpy中ndarray的常见操作
- 81.(cesium之家)cesium修改灰色背景(默认蓝色)
- Kotlin - 协程构建器 CoroutineBuilder
- Shell综合应用案例,归档文件
- MPLS multi protocol label switching technology
- Chat software project development 2
- Installation and configuration of [basic services] [database] Clickhouse
- BGP的路由黑洞和防环
猜你喜欢

Easy gene | introduction to macrovirus sequencing technology

Game partner topic: breederdao and ultiverse have established a new metauniverse

【微信小程序】零基础学 | 小程序语法

Shell综合应用案例,归档文件

分组卷积(Group Converlution)

易基因|宏病毒组测序技术介绍

Group convolution

YGG cooperates with my pet hooligan, AMGI's flagship NFT project, to enter the rabbit hole

81.(cesium之家)cesium修改灰色背景(默认蓝色)

解决IBGP的水平分割和BGP选路原则
随机推荐
After being fined "paid leave" for one month, Google fired him from AI on "love"
MPLS multi protocol label switching technology
81. (cesium home) cesium modifies the gray background (default blue)
"Enterprise management" sincere crm+ - integrated management of enterprise business processes
Chat software project development 2
QT信号与槽连接(松耦合)
The sandbox cooperates with artist Alec monopoly
arpspoof 安装和使用
Easycvr device management list page, paging data does not display problem repair
执行上下文与词法环境
CentOS7关于Oracle RAC 11GR2部署磁盘分区问题
单核A7玩转人脸识别,恩智浦“跨界处理器”又玩出新花样!
易基因|宏病毒组测序技术介绍
confd+etcd实现高可用自动发现
Centos7 about Oracle RAC 11gr2 deployment disk partition
BGP -- Border Gateway Protocol
第二章:遇到阻难!绕过WAF过滤!【SQL注入攻击】
How to check whether the pytorch you are using is a GPU version
BGP--边界网关协议
Small scenes bring great improvement! Baidu PaddlePaddle easydl helps AI upgrade of manufacturing assembly line