Attaches a cancellation token to the bound task.

Synopsis

Declared in <folly/coro/Task.h>

TaskWithExecutor
co_withCancellation(
    folly::CancellationToken cancelToken,
    TaskWithExecutor&& task) noexcept;
Note

This function is a hidden friend of TaskWithExecutor, declared only inside that class: it can be found only through argument-dependent lookup.

Return Value

the bound task with the cancellation token attached

Parameters

Name

Description

cancelToken

the cancellation token to associate with the task

task

the bound task to attach the token to

Created with MrDocs