Re:Async Cancellation
by ibraheemdev on Thursday November 11, 2021 @09:58PM
(#29195882)
The underlying implementation sets the task as cancelled the first time it is polled, and then waits for it to stop running [0]. So you could just call `cancel` and poll the future once:
[0]: https://docs.rs/async-task/4.0.3/src/async_task/task.rs.html...
[ Parent
| on HN ]
Re:Async Cancellation
by sizediterable on Thursday November 11, 2021 @10:26PM
(#29196033)
This seems to be for the `async-task` crate. My question was about `async_std::task` in particular since it doesn't have cancel-on-drop behavior.
Re:Async Cancellation
by ibraheemdev on Thursday November 11, 2021 @11:02PM
(#29196198)
async-std uses async-task under the hood.
(async-std -> async-global-executor -> async-executor -> async-task)
Re:Async Cancellation
by sizediterable on Friday November 12, 2021 @12:07AM
(#29196467)
ah, makes sense!