What is Nostr?
yosh /
npub1u86…6gze
2024-11-12 02:02:07

yosh on Nostr: I think there are three main culprits why cancellation in async Rust is considered ...

I think there are three main culprits why cancellation in async Rust is considered hard:

- `task::spawn` does not propagate cancellation
- `async fn {next,read,write} underpinned by `fn poll_{next,read,write}` do not respect cancellation
- cancellation is an exceptional state; `select!{}` abuses it for regular control flow

When cancellation doesn’t propagate if used with concurrent execution, parallel execution, async iteration, or async IO — it should be no surprise people struggle with it.
Author Public Key
npub1u86g6tc80vx4zt5xv6lh5rwammfwgs7envxf9nk02aa5u59cv43shd6gze