Function cros_async::unblock

source ·
pub fn unblock<F, R, G>(f: F, cancel: G) -> impl Future<Output = R>where
    F: FnOnce() -> R + Send + 'static,
    R: Send + 'static,
    G: Fn() -> R + Send + 'static,
Expand description

Spawn a task to run in the CancellableBlockingPool static executor.

cancel in-flight operation. cancel is called on operation during disarm or during shutdown. Cancel may be called multiple times if running task doesn’t get cancelled on first attempt.

Callers may await the returned Task to be notified when the work is completed.

See also: spawn.