kotlin.coroutines.suspendCoroutine 의 사용 사례를 보고하고, kotlinx.coroutines 종속성이 있는 경우 kotlinx.coroutines.suspendCancellableCoroutine 으로 교체할 것을 권장합니다.

suspendCancellableCoroutine 변형은 구조화된 동시성과 적절한 자원 관리를 위해 중요한 내장 취소 지원 기능을 제공합니다.

예:


    suspend fun usage(): String {
        return suspendCoroutine { continuation ->
            continuation.resume("Hello!")
        }
    }

빠른 수정을 적용한 후:


    suspend fun usage(): String {
        return suspendCancellableCoroutine { continuation ->
            continuation.resume("Hello!")
        }
    }