Skip to main content

spawn_task

Function spawn_task 

Source
pub fn spawn_task<F>(
    pending_tasks: &Mutex<Vec<JoinHandle<()>>>,
    description: &'static str,
    fut: F,
)
where F: Future<Output = Result<()>> + Send + 'static,
Expand description

Spawns an async task and tracks its handle in pending_tasks.

Prunes finished handles before adding the new one to prevent unbounded growth.

ยงPanics

Panics if the pending_tasks mutex is poisoned.