#tokio-task #task #abort #cancel #join #drop

abort-on-drop

A wrapper of Tokio's JoinHandle that aborts the task when it's dropped, while still allowing it to be awaited for joining

4 releases

0.2.2 Aug 4, 2022
0.2.1 Apr 27, 2022
0.2.0 Apr 27, 2022
0.1.0 Apr 27, 2022

#965 in Asynchronous

Download history 5994/week @ 2024-10-22 5344/week @ 2024-10-29 4140/week @ 2024-11-05 3664/week @ 2024-11-12 5154/week @ 2024-11-19 3490/week @ 2024-11-26 3971/week @ 2024-12-03 4056/week @ 2024-12-10 3908/week @ 2024-12-17 2121/week @ 2024-12-24 3257/week @ 2024-12-31 5292/week @ 2025-01-07 4729/week @ 2025-01-14 6190/week @ 2025-01-21 5089/week @ 2025-01-28 4455/week @ 2025-02-04

21,235 downloads per month
Used in 3 crates (2 directly)

BSD-2-Clause

6KB
116 lines

abort-on-drop

This crate provides a wrapper type of Tokio's JoinHandle: ChildTask, which aborts the task when it's dropped. ChildTask can still be awaited to join the child-task, and abort-on-drop will still trigger while it is being awaited.

For example, if task A spawned task B but is doing something else, and task B is waiting for task C to join, aborting A will also abort both B and C.


lib.rs:

This crate provides a wrapper type of Tokio's JoinHandle: ChildTask, which aborts the task when it's dropped. ChildTask can still be awaited to join the child-task, and abort-on-drop will still trigger while it is being awaited.

For example, if task A spawned task B but is doing something else, and task B is waiting for task C to join, aborting A will also abort both B and C.

Dependencies

~2.2–8MB
~62K SLoC