Class SimulationDispatcher::Submission

Nested Relationships

This class is a nested type of Class SimulationDispatcher.

Class Documentation

class Submission

Declaration: final

Copyable submission endpoint, with no borrowed dispatcher or game pointer.

Queueing always defers execution, including submissions from the owner thread. Rejection throws failed_operation; accepted callback failures reach their future. Submission is thread-safe while the endpoint remains alive. Own callable captures through execution/cancellation; reference captures/results remain the caller’s lifetime responsibility. Do not wait from the execution owner.

Public Functions

template<typename Work>
inline std::future<std::invoke_result_t<std::decay_t<Work>&>> submit(Work &&work) const

Declaration: [[nodiscard]]

Queue an owned callable for deferred simulation-owner execution.

See also

Detailed guide

Template Parameters:

Work – Callable invocable without arguments; move-only captures and void/value/reference results are supported.

Parameters:

work – Callable forwarded into owned queue storage; borrowed captures/results remain the caller’s lifetime responsibility.

Throws:

CE::Exceptions::failed_operation – If no active accepting runtime queue exists. Allocation/callable construction failures can propagate before acceptance. Always queues, even from the owner thread. Do not wait on this future from the execution owner. Delivery precedes input transfer at an actual update boundary in either execution mode; capture game state only with its simulation-owner lifetime protected.

Returns:

Future holding the invocation result or its exception; cancellation before entry produces broken_promise.