Hacker News new | ask | show | jobs
by amelius 4020 days ago
But how does one elegantly stop a chain of futures from executing when one is no longer interested in the final outcome of this chain of futures?
3 comments

Folly Futures support interrupts and cancellations. See https://github.com/facebook/folly/blob/master/folly/futures/...
In microsoft-land where I reside, they are called tasks and we cancel tasks.

Technically all tasks can be collected in a list and then you just cancel everything in the list but I have yet to find a scenario where I've needed this.

com.twitter.util.Future supports raising interrupts that propagate 'backwards' through the chain (and across network boundaries.) This is used to implement cancellation, among other things.

https://github.com/twitter/util/blob/master/util-core/src/ma...