Skip to main content

netget/utils/
task_guard.rs

1//! Stop a helper task when its owner goes away: aborting a task does not abort the tasks it
2//! spawned, so a connection's reader task is held in one of these.
3
4pub struct AbortOnDrop(pub tokio::task::JoinHandle<()>);
5
6impl Drop for AbortOnDrop {
7    fn drop(&mut self) {
8        self.0.abort();
9    }
10}