folly::coro::co_withCancellation

Attaches a cancellation token to the pending next-value operation.

Synopsis

Declared in <folly/coro/AsyncGenerator.h>

NextSemiAwaitable
co_withCancellation(
    CancellationToken cancelToken,
    NextSemiAwaitable&& awaitable);

Return Value

The semi-awaitable carrying the cancellation token.

Parameters

NameDescription
cancelTokenThe cancellation token to attach.
awaitableThe semi-awaitable to attach the token to.