startCoroutineCancellable

fun <T> (suspend () -> T).startCoroutineCancellable(
    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.