suspend 함수 내의 runBlocking 호출을 참조합니다.
suspend 함수 내에서 runBlocking을 사용하면 호출 스레드를 차단하여 비동기 프로그래밍의 목적에 어긋납니다.
빠른 수정에서는 컨텍스트에 따라 다음 중 하나로 runBlocking 호출을 대체합니다.
run 호출.CoroutineContext가 사용되는 경우 withContext 호출runBlocking 래퍼 없이 직접 인라인화된 코드예:
suspend fun something() {
runBlocking {
code() // 여기서 스레드가 막힙니다
}
}
빠른 수정을 적용한 후:
suspend fun something() {
code() // 비동기 실행
}
2025.1에서 추가