|
Open Model Railroad Network (OpenMRN)
|
Utility class to block an executor for a while. More...
#include <test_main.hxx>
Public Member Functions | |
| BlockExecutor (ExecutorBase *e) | |
| Creates a block against executor e and waits until the block suceeds. | |
| virtual void | run () |
| Entry point. | |
| void | wait_for_blocked () |
| Blocks the current thread until the BlockExecutor manages to block the executor it was scheduled on. | |
| void | release_block () |
| Releases the executor that was blocked. | |
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. | |
Private Attributes | |
| SyncNotifiable | n_ |
| notified (from the executor thread) when the block gets in place. | |
| SyncNotifiable | m_ |
| notified (from the test/operator thread) to release the block. | |
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 | |
Utility class to block an executor for a while.
Usage: add an instance of BlockExecutor to the executor you want to block, (using ExecutorBase::add) then call wait_for_blocked() and later release_block() to unblock the executor.
Definition at line 269 of file test_main.hxx.
|
inline |
Definition at line 272 of file test_main.hxx.
|
inline |
Creates a block against executor e and waits until the block suceeds.
| e | is the executor to block; ff e==null, then blocks g_executor. |
Definition at line 279 of file test_main.hxx.
|
inline |
Releases the executor that was blocked.
Definition at line 308 of file test_main.hxx.
|
inlinevirtual |
Entry point.
This funciton will be called when *this gets scheduled on the CPU.
Implements Executable.
Definition at line 292 of file test_main.hxx.
|
inline |
Blocks the current thread until the BlockExecutor manages to block the executor it was scheduled on.
Definition at line 302 of file test_main.hxx.
|
private |
notified (from the test/operator thread) to release the block.
Definition at line 319 of file test_main.hxx.
|
private |
notified (from the executor thread) when the block gets in place.
Definition at line 317 of file test_main.hxx.