|
morph 0.1.0
Asynchronous bridge between GUI thread and business models
|
Abstract executor interface. More...
#include <executor.hpp>
Public Member Functions | |
| IExecutor (const IExecutor &)=delete | |
| IExecutor & | operator= (const IExecutor &)=delete |
| IExecutor (IExecutor &&)=delete | |
| IExecutor & | operator= (IExecutor &&)=delete |
| virtual void | post (std::function< void()> task)=0 |
Schedules task for asynchronous execution. | |
| virtual bool | isSerial () const noexcept |
| Whether this executor runs one task at a time, each after the tasks posted before it: a strand, a GUI loop, a pumped MainThreadExecutor. | |
| ::core::async::IExecutor & | coreExecutor () noexcept |
| This executor as a core-cpp executor: the identity an core::async::ExecutorScope names. | |
Abstract executor interface.
Concrete implementations decide where and when posted tasks run (thread pool, main thread, Qt event loop, …).
An executor is an identity, so it is neither copyable nor movable: it owns the core-cpp adapter (coreExecutor()) that holds a pointer back to it.
Definition at line 70 of file executor.hpp.
|
pure virtual |
Schedules task for asynchronous execution.
Thread-safe. The task is invoked at some point after this call returns. Any exception thrown by the task is silently swallowed unless the implementation documents otherwise.
| task | Callable to execute. |
Implemented in morph::exec::MainThreadExecutor, morph::exec::OwnerStrand, morph::exec::ThreadPoolExecutor, morph::qt::QtExecutor, morph::testing::StepExecutor, and morph::tui::LoopExecutor.
|
inlinenodiscardvirtualnoexcept |
Whether this executor runs one task at a time, each after the tasks posted before it: a strand, a GUI loop, a pumped MainThreadExecutor.
What an owner must be: a component whose state is touched only in its owner's tasks needs those tasks never to overlap. A pool runs several at once, and the inline executor runs each wherever it is posted from.
Reimplemented in morph::exec::ThreadPoolExecutor.
Definition at line 94 of file executor.hpp.
|
inlinenodiscardnoexcept |
This executor as a core-cpp executor: the identity an core::async::ExecutorScope names.
Definition at line 100 of file executor.hpp.