Coroutine Context와
스위치 스레드 JVM 옵션에 -Dkotlinx.coroutines.debug를 넣어 다음 코드를 실행해 보겠습니다(디버그 확인). newSingleThreadContext(“Ctx1”).use { ctx1 -> newSingleThreadContext(“Ctx2”).use { ctx2 -> runBlocking(ctx1) { log(“Started in ctx1”) withContext(ctx2) { log(“Working in ctx2”) } log(“Back to ctx1”) } } } 완전한 코드는 여기에서 찾을 수 있습니다 그것은 몇 가지 새로운 기술을 보여줍니다. 하나는 실행 차단명시적으로 인스턴스화된 컨텍스트가 있고 다른 … Read more