|
Open Model Railroad Network (OpenMRN)
|
An Executable that runs a callback on the executor and returns once the run is complete. More...
Public Member Functions | |
| SyncExecutable (ExecutorBase *e, std::function< void()> &&fn) | |
| void | run () OVERRIDE |
| Entry point. | |
Public Member Functions inherited from Executable | |
| void | test_deletion () |
| void | notify () override |
| Crashes the program – everyone who is expecting notify calls must override this function. | |
| virtual void | alloc_result (QMember *item) |
| Return the result of an alloc_async() from a memory Pool. | |
Public Member Functions inherited from QMember | |
| void | init () |
| Initiailize a QMember, in place of a public placement construction. | |
Public Attributes | |
| std::function< void()> | fn_ |
| Callback to run. | |
| SyncNotifiable | n_ |
| Blocks the calling thread until the callback is done running. | |
Additional Inherited Members | |
Protected Member Functions inherited from QMember | |
| QMember () | |
| Constructor. | |
| ~QMember () | |
| Destructor. | |
Protected Attributes inherited from QMember | |
| QMember * | next |
| pointer to the next member in the queue | |
An Executable that runs a callback on the executor and returns once the run is complete.
Must not be created against the local executor (because that would deterministically deadlock).
Usage:
SyncExecutable(stack.executor(), [] { DoFooBar(); });
Definition at line 127 of file Executor.cxx.
|
inline |
| e | is the executor on which to execute the callback |
| fn | is the callback to execute. Caller should use std::move to get the callback in here. |
Definition at line 133 of file Executor.cxx.
|
inlinevirtual |
Entry point.
This funciton will be called when *this gets scheduled on the CPU.
Implements Executable.
Definition at line 140 of file Executor.cxx.
| std::function<void()> SyncExecutable::fn_ |
Callback to run.
Definition at line 146 of file Executor.cxx.
| SyncNotifiable SyncExecutable::n_ |
Blocks the calling thread until the callback is done running.
Definition at line 148 of file Executor.cxx.