Weak UI invocation context using the existing UiTask awaiters and scheduler. Copies never retain a scene, coroutine closure, node or background executor. Use owning coroutine parameters/captures; only background's separate callable runs outside UI.
More...
#include <ui_async.hpp>
|
|
| AsyncContext ()=default |
| | Construct an unavailable invocation context.
|
| AsyncTimer | until (SchedulerTime deadline) const |
| AsyncTimer | after (std::chrono::milliseconds delay) const noexcept |
| template<class T> |
| AsyncReceive< T > | receive (std::function< void(AsyncReply< T >)> start) const |
template<class Output, class Input, class Work>
requires (std::copy_constructible<Work> && std::is_nothrow_move_constructible_v<Work>) |
| AsyncReceive< Output > | background (std::shared_ptr< const Input > input, Work work) const |
|
|
class | detail::AsyncInvocation |
Weak UI invocation context using the existing UiTask awaiters and scheduler. Copies never retain a scene, coroutine closure, node or background executor. Use owning coroutine parameters/captures; only background's separate callable runs outside UI.
◆ after()
| AsyncTimer portals::ui::AsyncContext::after |
( |
std::chrono::milliseconds | delay | ) |
const |
|
noexcept |
- Parameters
-
| delay | Nonnegative delay in milliseconds, relative to the existing application clock. |
- Returns
- Existing one-shot timer; zero delay still waits for scheduler dispatch. Negative duration or deadline overflow yields INVALID_ARGUMENT; expired context yields CLOSED, foreign use WRONG_THREAD.
◆ background()
template<class Output, class Input, class Work>
requires (std::copy_constructible<Work> && std::is_nothrow_move_constructible_v<Work>)
| AsyncReceive< Output > portals::ui::AsyncContext::background |
( |
std::shared_ptr< const Input > | input, |
|
|
Work | work ) const |
|
inline |
- Template Parameters
-
| Output | Transitively immutable result; expected<DomainValue, DomainError> remains domain data. |
| Input | Transitively immutable input with no concurrently mutated aliases. |
| Work | Copyable, nothrow-movable worker-safe callable under makeBackgroundJob's result contract. |
- Parameters
-
| input | Non-null owning immutable input; impose application byte limits independently. |
| work | Separate worker callable; never capture UI refs, this context, frame or invocation closure. |
- Returns
- The existing AsyncReceive, with UI-affine deferred continuation and cooperative cancellation. Full admission retains one latest intent and retries on application cycles without new input. Terminal admission retires that intent and reports ui.async.background once, even if handled. Returning its AsyncError from UiTask separately reports ui.async without a background cause; these are observations at the operation and task boundaries, not distinct underlying failures. Argument construction may throw before entry. No worker is created by this call itself.
◆ receive()
- Template Parameters
-
| T | Transitively immutable owning result with a worker-safe deleter. |
- Parameters
-
| start | Short UI callback receiving only the existing worker-safe reply endpoint. |
- Returns
- Existing bounded data awaiter; provider must retain rejected publication for retry.
◆ until()
- Parameters
-
| deadline | Absolute monotonic milliseconds in this invocation's scheduler. |
- Returns
- Existing one-shot timer; even due timers resume only through scheduler dispatch.
The documentation for this class was generated from the following file: