Skip to main content

spawn_background

Function spawn_background 

Source
pub async fn spawn_background<F, Fut>(
    thread_mgr: SharedThreadManager,
    options: SpawnOptions,
    task_fn: F,
) -> SubtaskHandle<()>
where F: FnOnce(CancellationToken, SharedThreadManager) -> Fut + Send + 'static, Fut: Future<Output = Result<(), String>> + Send + 'static,
Expand description

Spawn a long-running background thread.

Unlike subagents and tasks, background threads don’t have a natural return value. They run until cancelled.