Skip to main content

spawn_balanced

Function spawn_balanced 

Source
pub fn spawn_balanced<F>(future: F) -> JoinHandle<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,
Expand description

Spawn a task on one of the local runtimes, with a work balance heuristic.

Use this when you can do your work on any runtime and it does not matter which. Be mindful of cross-runtime synchronization and await, which is more costly in a level runtime than a regular tokio multi-thread runtime.