Blog post: Async Cancellation

Now that I think about it, async destructors and non-cancellable futures are somewhat the same solution. It's just the method used to cancel the future what changes. For async destructors, you would cancel a future by stopping to call poll and begining to call poll_drop. While for non-cancellable futures you could call some cancel() method and continue to call poll until the future returns ready. Either way, you must continue to call poll / poll_drop and finish the futures execution before it gets dropped.

With this in mind, I think stopping to poll a future may have been the wrong abstraction for future cancellation. In the other hand, changing the cancellation model now would be a masive breaking change in the ecosystem, and async destructors can fix the cancellation/completion problem without breaking anything.

2 Likes