cancelFutureOnCancellation

fun CancellableContinuation<*>.cancelFutureOnCancellation(future: Future<*>)

Cancels a specified future when this job is cancelled. This is a shortcut for the following code with slightly more efficient implementation (one fewer object created).

invokeOnCancellation { if (it != null) future.cancel(false) }

Sources

jvm source
Link copied to clipboard