可以在不同的协程之间共享相同的协程上下文吗?我测试过了,似乎运行正常。
val context = Dispatchers.IO + myThreadLocal.asContextElement() + myThreadContextElement
val deferredResultOne = async(context) { /* some work */ }
val deferredResultTwo = async(context) { /* some work */ }
val resultOne = deferredResultOne.await()
val resultTwo = deferredResultTwo.await()