Uni20
Asynchronous tensor and runtime library.
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
uni20::async::AsyncTaskPromise Class Referencefinal

Promise type for ordinary AsyncTask coroutines. More...

#include <async_task_promise.hpp>

Inheritance diagram for uni20::async::AsyncTaskPromise:
[legend]
Collaboration diagram for uni20::async::AsyncTaskPromise:
[legend]

Public Member Functions

AsyncTask get_return_object () noexcept
 
constexpr TaskPromiseBase () noexcept=default
 Default-construct the promise.
 
template<typename... Args>
 TaskPromiseBase (Args &&... args)
 Construct the promise and process coroutine arguments for debug metadata.
 
- Public Member Functions inherited from uni20::async::TaskPromiseBase
int add_awaiter () noexcept
 Increase the number of active awaiters by one.
 
int add_awaiter (int count) noexcept
 Increase the number of active awaiters by a specified count.
 
template<TaskAwaitable A>
auto await_transform (A &&a)
 Transforms rvalue awaitables into task-aware awaiters.
 
template<TaskFactoryAwaitable A>
auto await_transform (A &&a)
 
template<TaskAwaitable A>
auto await_transform (A &a)
 Transform an awaiter to transfer one task ownership claim.
 
template<TaskFactoryAwaitable A>
auto await_transform (A &a)
 Transform the awaiter to provide transfer of shared ownership of the TaskFactory.
 
template<typename T >
auto await_transform (T &&)
 Fallback await_transform overload that rejects unsupported awaitables.
 
template<typename Task >
requires std::derived_from<std::remove_cvref_t<Task>, BasicTask>
Task && await_transform (Task &&task) noexcept
 Pass through a concrete task that uses the shared basic task representation.
 
TaskHandle destroy_with_continuation () noexcept
 safely destroy this coroutine, returning the continuation_ (which also must now be destroyed)
 
auto final_suspend () noexcept
 
std::exception_ptr get_exception () noexcept
 Get the current exception pointer, or nullptr if there is no current exception.
 
bool has_started () const noexcept
 Query whether the coroutine has begun executing.
 
auto initial_suspend () noexcept
 Suspend immediately on coroutine entry.
 
template<TaskPromise Promise>
TaskHandle initialize_task (std::coroutine_handle< Promise > handle) noexcept
 Cache erased self-identity and register the initial ownership claim.
 
bool is_cancel_on_resume () const noexcept
 Reports whether cancellation-on-resume is currently set.
 
void mark_started () noexcept
 Mark the coroutine as having been scheduled to start executing.
 
std::optional< int > preferred_numa_node () const noexcept
 Retrieve the preferred NUMA node for this coroutine.
 
void register_exception_sink (ExceptionSinkNode &node, std::shared_ptr< EpochContext > epoch, bool explicit_sink)
 Register one exception propagation sink with this promise.
 
bool release_awaiter () noexcept
 Decrease the number of active awaiters by one.
 
bool release_awaiter (int count) noexcept
 Decrease the number of active awaiters by a specified count.
 
TaskHandle release_ownership ()
 Release ownership of the coroutine and return it, if it was exclusively owned.
 
void rethrow_exception ()
 Throw the current exception, if there is one.
 
constexpr void return_void () noexcept
 Called when the coroutine returns normally.
 
IScheduler * scheduler () const noexcept
 Return the scheduler currently recorded for this task.
 
TaskHandle self () noexcept
 Return this promise's erased coroutine identity.
 
void set_cancel_on_resume () noexcept
 Mark the coroutine for cancellation at next resume.
 
void set_exception (std::exception_ptr e) noexcept
 Record an exception for deferred rethrow on resume.
 
void set_preferred_numa_node (std::optional< int > node) noexcept
 Set the preferred NUMA node recorded for this coroutine.
 
BasicTask take_ownership () noexcept
 Acquire exclusive ownership of the coroutine.
 
TaskFactory take_shared_ownership (int count)
 Acquire shared ownership of the coroutine for use with multi-await constructs.
 
constexpr TaskPromiseBase () noexcept=default
 Default-construct the promise.
 
template<typename... Args>
 TaskPromiseBase (Args &&... args)
 Construct the promise and process coroutine arguments for debug metadata.
 
void unhandled_exception ()
 Called on unhandled exception escaping the coroutine.
 
void unregister_exception_sink (ExceptionSinkNode &node, bool from_destructor) noexcept
 Unregister one exception propagation sink from this promise.
 
 ~TaskPromiseBase () noexcept
 

Static Public Attributes

static constexpr TaskDomain task_domain = TaskDomain::host
 
- Static Public Attributes inherited from uni20::async::TaskPromiseBase
static constexpr int kNoPreferredNumaNode = std::numeric_limits<int>::min()
 

Additional Inherited Members

- Static Public Member Functions inherited from uni20::async::TaskPromiseBase
static bool can_transfer_directly (TaskHandle from, TaskHandle to) noexcept
 Report whether symmetric transfer is valid for two prepared task routes.
 
static void destroy_and_track (TaskHandle handle) noexcept
 Destroy a coroutine handle while recording destruction in the registry.
 
static void note_leaked (TaskHandle handle) noexcept
 Record that a coroutine has been intentionally leaked.
 
static void note_running (TaskHandle handle) noexcept
 Record that a coroutine has transitioned into a runnable/running state.
 
static void note_suspended (TaskHandle handle) noexcept
 Record that a coroutine has suspended and is waiting for resumption.
 
static void prepare_nested_route (TaskHandle parent, TaskHandle child)
 Complete an unbound child's route before nested execution.
 
static std::coroutine_handle resolve_await_suspend_result (TaskHandle current, BasicTask &&task)
 Resolve an await_suspend task return value into a coroutine transfer handle.
 
static void resume_and_track (TaskHandle handle)
 Resume a coroutine handle while recording the running transition.
 
template<TaskFactoryAwaitable A>
static void suspend_factory_awaitable (TaskHandle current, A &awaitable)
 Execute await_suspend for TaskFactoryAwaitable and apply TaskRegistry tracking.
 
template<TaskAwaitable A>
static auto suspend_task_awaitable (TaskHandle current, A &awaitable)
 Execute await_suspend for TaskAwaitable and apply TaskRegistry tracking.
 
- Public Attributes inherited from uni20::async::TaskPromiseBase
std::atomic< int > awaiter_count_ = 0
 Number of active ownership claims on this coroutine.
 
std::atomic< bool > cancel_on_resume_ {false}
 If true, then when the coroutine is next resumed (i.e.
 
TaskHandle continuation_ {}
 Uni20 task coroutines are nestable.
 
std::exception_ptr * continuation_exception_ = nullptr
 Destination for an exception returned by a directly awaited task.
 
std::exception_ptr eptr_ = nullptr
 
std::atomic< bool > exception_ {false}
 EpochContext can inject an exception into a coroutine, which will be thrown when resuming from an awaiter.
 
ExceptionSinkNode * exception_sinks_head_ {nullptr}
 
uint64_t Instance
 
std::string Name
 
std::atomic< int > preferred_numa_node_ {kNoPreferredNumaNode}
 Preferred NUMA node recorded for the coroutine.
 
std::atomic< bool > started_ {false}
 Tracks whether the coroutine has been scheduled or otherwise started.
 
- Static Protected Member Functions inherited from uni20::async::TaskPromiseBase
static void validate_scheduler_route (IScheduler *scheduler, TaskRoute route)
 Validate a prospective task route without changing promise state.
 

Detailed Description

Promise type for ordinary AsyncTask coroutines.

Member Function Documentation

◆ get_return_object()

AsyncTask uni20::async::AsyncTaskPromise::get_return_object ( )
inlinenoexcept

◆ TaskPromiseBase() [1/2]

constexpr uni20::async::TaskPromiseBase::TaskPromiseBase ( )
constexprdefaultnoexcept

Default-construct the promise.

◆ TaskPromiseBase() [2/2]

template<typename... Args>
uni20::async::TaskPromiseBase::TaskPromiseBase ( Args &&...  args)
inline

Construct the promise and process coroutine arguments for debug metadata.

Template Parameters
ArgsCoroutine argument types.
Parameters
argsCoroutine arguments forwarded for ProcessCoroutineArgument.

Member Data Documentation

◆ task_domain

constexpr TaskDomain uni20::async::AsyncTaskPromise::task_domain = TaskDomain::host
staticconstexpr

The documentation for this class was generated from the following file: