[Coroutine] suspendCoroutine과 suspendCancellableCoroutine
지난 callbackFlow에 이어서 callback를 coroutine 형태로 받을 수 있는 suspendCoroutine과 suspendCancellableCoroutine에 대해 알아보려고 합니다. 1. suspendCoroutine public suspend inline fun suspendCoroutine( crossinline block: (Continuation) -> Unit): T { } 먼저 suspendCoroutine에 대해 알아보도록 하겠습니다. 내부 코드와 함께 적힌 설명을 살펴보면, block 람다 함수는 Continuation 객체를 인자로 받으며, 비동기 작업이 완료되면 결과를 이 Continutaion 객체를 통해 반환합니다. Continuation 객체는 현재 코루틴 상..