cancelBy

fun <T> Async<T>.cancelBy(message: String? = null, cause: Throwable?)(source)

取消此 Async 任务,特别是将在任务中抛出一个 CancellationException 以终结任务。 如果 message 或 cause 指定了,则它们将被用于创建 CancellationException。

Parameters

message

取消原因,可以为 null

cause

引发取消的异常,可以为 null