proxygen
|
#include <Task.h>
Public Types | |
using | promise_type = detail::TaskPromise< T > |
Public Member Functions | |
Task (const Task &t)=delete | |
Task (Task &&t) noexcept | |
~Task () | |
Task & | operator= (Task t) noexcept |
void | swap (Task &t) noexcept |
FOLLY_NODISCARD TaskWithExecutor< T > | scheduleOn (Executor *executor)&&noexcept |
Private Types | |
using | handle_t = std::experimental::coroutine_handle< promise_type > |
Private Member Functions | |
Task (handle_t coro) noexcept | |
Private Attributes | |
handle_t | coro_ |
Friends | |
class | detail::TaskPromiseBase |
class | detail::TaskPromise< T > |
Represents an allocated, but not-started coroutine, which is not yet been bound to an executor.
You can only co_await a Task from within another Task, in which case it is implicitly bound to the same executor as the parent Task.
Alternatively, you can explicitly provide an executor by calling the task.scheduleOn(executor) method, which will return a new not-yet-started TaskWithExecutor that can be co_awaited anywhere and that will automatically schedule the coroutine to start executing on the bound executor when it is co_awaited.
Within the body of a Task's coroutine, it will ensure that it always executes on the bound executor by implicitly transforming every 'co_await expr' expression into `co_await co_viaIfAsync(boundExecutor, expr)' to ensure that the coroutine always resumes on the executor.
|
private |
using folly::coro::Task< T >::promise_type = detail::TaskPromise<T> |
|
delete |
|
inlinenoexcept |
|
inline |
|
inlineprivatenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
Specify the executor that this task should execute on.
Returns a new task that when co_awaited will launch execution of this task on the specified executor.
Definition at line 294 of file Task.h.
References folly::exchange(), and folly::pushmi::executor.
|
inlinenoexcept |
Definition at line 285 of file Task.h.
References FOLLY_NODISCARD, folly::f14::swap(), and folly::pushmi::detail::t.
|
friend |
|
friend |
|
private |