Kotlin协程

158 阅读1分钟

1.Scope

1.开启一个scope:

withContext(Dispatchers.IO){
//……



}

2.创建scope的函数列举

  • fun CoroutineScope.launch()

  • fun CoroutineScope.async()

  • suspend fun withContext()

  • suspend fun coroutineScope()

  • suspend fun supervisorScope()