|
Aria 2.0.0
C++23 MVVM framework (C++20 minimum) — reactive, coroutine-first, ABI-layered
|
#include <virtual_time_executor.hpp>
Public Types | |
| using | clock = std::chrono::steady_clock |
| using | duration = std::chrono::milliseconds |
Public Member Functions | |
| VirtualTimeExecutor ()=default | |
| aria::SchedulerCaps | caps () const noexcept override |
| Capabilities: Post (immediate), Delay (deadline-keyed), GraphSafe. | |
| void | schedule (std::function< void()> fn) override |
| Submit fn for execution "soon". Defines Caps::Post. | |
| void | schedule_after (std::chrono::milliseconds delay, std::function< void()> fn) override |
| Submit fn for execution after delay. | |
| void | post (std::function< void()> fn) override |
| IExecutor: schedule "now" — runs at the current virtual time when the next advance_by()/run_until_idle() is called. | |
| void | post_after (duration delay, std::function< void()> fn) override |
| Schedule to run after delay of virtual time. | |
| duration | now () const noexcept |
| Current virtual time (since construction). | |
| std::size_t | pending () const noexcept |
| Number of scheduled tasks not yet fired. | |
| std::size_t | advance_by (duration delta) |
| Advance virtual time by delta, firing tasks in deadline order. | |
| std::size_t | advance_to (duration target) |
| Advance to an absolute virtual time target (must be >= now()). | |
| std::size_t | run_until_idle () |
| Run everything currently queued without advancing time beyond the last deadline. | |
| void | clear () noexcept |
| Drop all scheduled tasks without firing them. | |
| Public Member Functions inherited from aria::async::IExecutor | |
| ~IExecutor () override=default | |
| 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 bool | is_main_thread () const noexcept |
| True iff the calling thread is the scheduler's "main" thread. | |
| Public Member Functions inherited from aria::IDelayedScheduler | |
| ~IDelayedScheduler () override | |
| using aria::async::VirtualTimeExecutor::clock = std::chrono::steady_clock |
| using aria::async::VirtualTimeExecutor::duration = std::chrono::milliseconds |
|
default |
|
inlinenodiscardoverridevirtualnoexcept |
Capabilities: Post (immediate), Delay (deadline-keyed), GraphSafe.
Reimplemented from aria::async::IExecutor.
|
inlineoverridevirtual |
Submit fn for execution "soon". Defines Caps::Post.
Reimplemented from aria::async::IExecutor.
|
inlineoverridevirtual |
Submit fn for execution after delay.
Default implementation throws unsupported_capability; implementations that advertise Caps::Delay MUST override.
Reimplemented from aria::IScheduler.
|
inlineoverridevirtual |
IExecutor: schedule "now" — runs at the current virtual time when the next advance_by()/run_until_idle() is called.
Implements aria::async::IExecutor.
|
inlineoverridevirtual |
Schedule to run after delay of virtual time.
(Also implements IDelayedScheduler.)
Implements aria::IDelayedScheduler.
|
inlinenodiscardnoexcept |
Current virtual time (since construction).
|
inlinenodiscardnoexcept |
Number of scheduled tasks not yet fired.
|
inline |
Advance virtual time by delta, firing tasks in deadline order.
Returns the number of tasks fired.
|
inline |
Advance to an absolute virtual time target (must be >= now()).
|
inline |
Run everything currently queued without advancing time beyond the last deadline.
Useful when you only want to drain "post()" tasks (delay == 0) without simulating a time jump.
|
inlinenoexcept |
Drop all scheduled tasks without firing them.