#tokio-task #task #abort #join #cancel #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

#943 in Asynchronous

Download history 4597/week @ 2024-11-16 4088/week @ 2024-11-23 4085/week @ 2024-11-30 3941/week @ 2024-12-07 4161/week @ 2024-12-14 2188/week @ 2024-12-21 2746/week @ 2024-12-28 5389/week @ 2025-01-04 5044/week @ 2025-01-11 5693/week @ 2025-01-18 5388/week @ 2025-01-25 5112/week @ 2025-02-01 4375/week @ 2025-02-08 3564/week @ 2025-02-15 4102/week @ 2025-02-22 3788/week @ 2025-03-01

16,954 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