Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
BlockExecutor Class Reference

Utility class to block an executor for a while. More...

#include <test_main.hxx>

Inheritance diagram for BlockExecutor:
Executable Notifiable QMember Destructable

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
QMembernext
 pointer to the next member in the queue
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ BlockExecutor() [1/2]

BlockExecutor::BlockExecutor ( )
inline

Definition at line 272 of file test_main.hxx.

◆ BlockExecutor() [2/2]

BlockExecutor::BlockExecutor ( ExecutorBase e)
inline

Creates a block against executor e and waits until the block suceeds.

Parameters
eis the executor to block; ff e==null, then blocks g_executor.

Definition at line 279 of file test_main.hxx.

Member Function Documentation

◆ release_block()

void BlockExecutor::release_block ( )
inline

Releases the executor that was blocked.

Definition at line 308 of file test_main.hxx.

◆ run()

virtual void BlockExecutor::run ( )
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.

◆ wait_for_blocked()

void BlockExecutor::wait_for_blocked ( )
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.

Member Data Documentation

◆ m_

SyncNotifiable BlockExecutor::m_
private

notified (from the test/operator thread) to release the block.

Definition at line 319 of file test_main.hxx.

◆ n_

SyncNotifiable BlockExecutor::n_
private

notified (from the executor thread) when the block gets in place.

Definition at line 317 of file test_main.hxx.


The documentation for this class was generated from the following file: