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!")
}
}