当前位置:网站首页>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 . |
边栏推荐
猜你喜欢

查询字段较多时可以添加普通查询和高级查询两种情况

Summary of message queue knowledge points
![[record of question brushing] 22. bracket generation](/img/0d/8881fcbcd0e963875dff2946b95865.png)
[record of question brushing] 22. bracket generation

St table, weighted and search set

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

"Enterprise management" sincere crm+ - integrated management of enterprise business processes

BUU刷题记4

Easycvr device management list page, paging data does not display problem repair
![Shell函数、系统函数、basename [string / pathname] [suffix] 可以理解为取路径里的文件名称 、dirname 文件绝对路径、自定义函数](/img/3d/d7276d2010f1d77a3bd572cc66eced.png)
Shell函数、系统函数、basename [string / pathname] [suffix] 可以理解为取路径里的文件名称 、dirname 文件绝对路径、自定义函数

Houdini notes 2
随机推荐
【微信小程序】零基础学 | 小程序语法
Execution context and Lexical Environment
Task 1 report
QT signal and slot connection (loose coupling)
Robin Lee was "poured cold water" enthusiasm! Baidu allied with Huawei Kirin to release "Honghu" chip
Bean injection and lifecycle
从零开始搭建Prometheus自动监控报警系统
为什么 ThreadLocal 可以做到线程隔离?
营销与销售文件管理以及工作流程解决方案
Confid+etcd to realize automatic discovery of high availability
Solve the horizontal segmentation of iBGP and BGP routing principles
Easy gene | introduction to macrovirus sequencing technology
第二章:遇到阻难!绕过WAF过滤!【SQL注入攻击】
Auto.js 旋转图标
What functions does the medical live broadcast platform need
How to check whether the pytorch you are using is a GPU version
数据块的存储系统中缓存的作用是什么?
5.20晚上单身狗都在哪里?
全球最聪明50家公司公布:中国厂商占据近半,华为名列第一
confd+etcd实现高可用自动发现