startCoroutineCancellable

fun <R, T> (suspend (R) -> T).startCoroutineCancellable(
    receiver: R,
    completion: Continuation<T>
): Unit
(source)

Use this function to start coroutine in a cancellable way, so that it can be cancelled while waiting to be dispatched.