suspendAtomicCancellableCoroutine

inline suspend fun <T> suspendAtomicCancellableCoroutine(
    holdCancellability: Boolean = false,
    crossinline block: (CancellableContinuation<T>) -> Unit
): T
(source)

Suspends coroutine similar to suspendCancellableCoroutine, but with atomic cancellation.

When suspended function throws CancellationException it means that the continuation was not resumed. As a side-effect of atomic cancellation, a thread-bound coroutine (to some UI thread, for example) may continue to execute even after it was cancelled from the same thread in the case when the continuation was already resumed and was posted for execution to the thread’s queue.