Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
Loading...
Searching...
No Matches
aria::async::InlineExecutor Class Reference

Inline executor — runs callable synchronously on the calling thread. More...

#include <executor.hpp>

Inheritance diagram for aria::async::InlineExecutor:
[legend]

Public Member Functions

void post (std::function< void()> fn) override
 Synchronously runs fn on the caller's thread.
aria::SchedulerCaps caps () const noexcept override
 Capability bitmask.
Public Member Functions inherited from aria::async::IExecutor
 ~IExecutor () override=default
void schedule (std::function< void()> fn) override
 Submit fn for execution "soon". Defines Caps::Post.
virtual bool is_safe_graph_executor () const noexcept
 True iff this executor is safe to use as the graph-thread (UI) executor.
virtual bool is_safe_worker_executor () const noexcept
 True iff this executor can host worker tasks.
Public Member Functions inherited from aria::IScheduler
virtual ~IScheduler ()=default
virtual void schedule_after (std::chrono::milliseconds delay, std::function< void()> fn)
 Submit fn for execution after delay.
virtual bool is_main_thread () const noexcept
 True iff the calling thread is the scheduler's "main" thread.

Detailed Description

Inline executor — runs callable synchronously on the calling thread.

InlineExecutor is suitable for single-threaded scenarios where every actor (graph, worker, dispatcher) lives on the same thread, and for use as a worker executor in tests. It must NOT be used as the graph-thread (UI) executor together with a multi-threaded worker: when the coroutine hops back via co_await schedule_on(ui) after running on the worker, InlineExecutor::post(fn) would synchronously run fn on the worker thread, tripping the reactive graph thread-affinity assert.

AsyncCommand enforces this at compile time via the executor traits (is_safe_graph_executor_v / is_safe_worker_executor_v); see executor_traits.hpp and the static_asserts in async_command.hpp.

Member Function Documentation

◆ post()

void aria::async::InlineExecutor::post ( std::function< void()> fn)
inlineoverridevirtual

Synchronously runs fn on the caller's thread.

Exceptions are captured and reported via the unified callback-failure sink so the inline path matches the contract of every other executor in the framework — failures never escape post().

Implements aria::async::IExecutor.

◆ caps()

aria::SchedulerCaps aria::async::InlineExecutor::caps ( ) const
inlinenodiscardoverridevirtualnoexcept

Capability bitmask.

Implementations should return a constant value (or at least a value stable across the object's lifetime).

Reimplemented from aria::async::IExecutor.


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