cancelFutureOnCompletion

fun Job.cancelFutureOnCompletion(
    future: Future<*>
): DisposableHandle
(source)

Platform and version requirements: JVM

Cancels a specified future when this job is complete.

This is a shortcut for the following code with slightly more efficient implementation (one fewer object created).

invokeOnCompletion { future.cancel(false) }