我正在将现有的应用程序从Java转换为Kotlin。该应用程序创建一个IntentService,该IntentService在后台线程中运行,并负责执行某些操作,这些操作会suspend无限期地重复阻止具有功能的线程(例如,网络调用,数据库交互)。由于“当前线程”实际上是后台线程,因此我不会阻止UI。
suspend
runBlocking在当前线程上运行所有挂起函数是否是一个好习惯?还是有更好的方法?
runBlocking
multithreading android kotlin kotlinx.coroutines
android ×1
kotlin ×1
kotlinx.coroutines ×1
multithreading ×1