Function spawn_blocking

Source
pub fn spawn_blocking<T: Send + 'static>(
    func: impl FnOnce() -> T + Send + 'static,
) -> JoinHandle<T> 
Expand description

Spawns a blocking function in a separate task using the blocking pool and returns a JoinHandle which can be used to await the result. The function has access to the current TurboTasks context and runs in the same tracing span. Allocations and cpu time is accounted to the current turbo-tasks function.