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.
- `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.