Add CancellationToken support to AsyncGenerator
Summary: An AsyncGenerator coroutine now has an implicit associate CancellationToken that is inherited from the calling context of each `co_await gen.next()` call. This means that generators that correspond to long-running subscriptions now have an in-built channel that allows them to cancel the subscription. This is also useful for algorithms that introduce concurrency in processing of stream data. eg. The `buffer()` or `merge()` algorithms. Reviewed By: kirkshoop Differential Revision: D16833864 fbshipit-source-id: be8faf1ec438c4248091e02d6a264d3760e2d73d
Showing
Please register or sign in to comment