Skip to main content

spawn_tracked_task

Function spawn_tracked_task 

Source
pub fn spawn_tracked_task<F, T>(fut: F) -> JoinHandle<T> ⓘ
where F: Future<Output = T> + Send + 'static, T: Send + 'static,
Expand description

Spawn a task that daemon shutdown’s drain() waits for and return its join handle. Retaining the handle lets boot coordinators form an explicit barrier; dropping it deliberately detaches the task while the background counter still keeps daemon drain aware of its lifetime. The decrement happens via BackgroundTaskGuard’s Drop, including panic and cancellation paths.