Expand description
Owned tokio task handle with abort-on-drop semantics.
Consolidates the ad-hoc BackgroundTaskGuard, SignalHandlerGuard, and
ProgressUpdateGuard shapes previously reimplemented per crate: each held
an Option<JoinHandle<()>> and aborted it on drop. (TimeoutWarningGuard
is intentionally separate: it drives cooperative cancellation through a
CancellationToken with an explicit async cancel(), not abort-on-drop.)
Use this type for new owned background tasks instead of adding another
local guard.
§Usage
use vtcode_commons::TaskGuard;
let guard = TaskGuard::with_label(tokio::spawn(async {}), "file-palette");
// Dropping `guard` aborts the task; `guard.disarm()` releases the handle.Detached use remains possible via disarm() plus an explicit
documented-detached comment at the call site (see “Task Extent, Error
Propagation, and Cancel-Safety” in docs/guides/async-architecture.md).
Structs§
- Task
Guard - RAII owner for a spawned tokio task.