A cancellable version of AsyncScope. Work added to this scope will be provided a cancellation token for cancelling during join.
Synopsis
Declared in <folly/coro/AsyncScope.h>
class CancellableAsyncScope;
Description
See add() and cancelAndJoinAsync() for more information.
Note: Task and AsyncGenerator will ignore the internal cancellation signal if they already have a cancellation token (i.e. if someone has already called co_withCancellation on them.) If you need an external cancellation signal as well, pass that token to this constructor or to add() instead of attaching it to the Awaitable.
refcode folly/docs/examples/folly/coro/CancellableAsyncScope.cpp
Member Functions
Name |
Description |
|
Constructors |
Start the specified task/awaitable by co_awaiting it. The awaitable will be provided a cancellation token to respond to cancelAndJoinAsync() in the future. |
|
Like add(), but records the call‐site source location for diagnostics. |
|
Request cancellation and asynchronously wait for all started tasks to complete. |
|
Schedules the given task on the current executor and adds it to the AsyncScope. The task will be provided a cancellation token to respond to cancelAndJoinAsync() in the future. |
|
Query if cancellation was requested on the tasks added to this AsyncScope. |
|
Asynchronously wait for all started tasks to complete without requesting cancellation. |
|
Query the number of tasks added to the scope that have not yet completed. |
|
Request cancellation for all started tasks that accepted a CancellationToken in add(). |
Non-Member Functions
Name |
Description |
Yield the results of a range of awaitables in order of completion. |
|
Yield the results of a vector of awaitables in order of completion. |
|
Yield Try results of a range of awaitables in order of completion. |
|
Yield Try results of a vector of awaitables in order of completion. |
Created with MrDocs