Skip to main content

spawn_blocking_on

Function spawn_blocking_on 

Source
pub fn spawn_blocking_on<F, R>(
    callbacks: &CallbackHandle,
    priority: CallbackPriority,
    f: F,
) -> JoinFuture<R> 
where F: FnOnce() -> R + Send + 'static, R: Send + 'static,
Expand description

Run a blocking closure f on a callback-pool worker — the RTEMS backend for crate::runtime::task::spawn_blocking. Returns a JoinFuture resolving to f’s return value.

A blocking closure has no suspension point, so it cannot be aborted mid-run (as tokio::task::spawn_blocking also cannot); abort before it starts still cancels it. A panic is isolated exactly as for spawn_future. It holds its worker for its whole run — that is what “blocking” means, and unlike a spawned future there is nothing to yield at.