Open
Description
Currently, we can provide a prompt cancellation guarantee if and only if the underlying dispatcher is an instance of CoroutineDispatcher
.
The reason is that prompt cancellation guarantee is cooperative -- it requires cooperation between dispatcher-agnostic CancellableContinuation
and the underlying intercepted continuation (link to the cooperation point).
Without such cooperation, it's easy to break and observe atomic cancellation.
We should find a mechanism to either workaround it or warn users about this issue. At the very least we have to document this behaviour.
Note that this is not an ephemeral issue and it was discovered during debugging of Lincheck misbehaviour when using with prompt cancellation