Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save aleksandarzekovic/c4dd5fbec1f92e8b3ad6aab92b47140d to your computer and use it in GitHub Desktop.
Save aleksandarzekovic/c4dd5fbec1f92e8b3ad6aab92b47140d to your computer and use it in GitHub Desktop.
@InternalCoroutinesApi
public fun <T> Continuation<T>.resumeCancellableWith(
result: Result<T>,
onCancellation: ((cause: Throwable) -> Unit)? = null
): Unit = when (this) {
is DispatchedContinuation -> resumeCancellableWith(result, onCancellation)
else -> resumeWith(result)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment