|
Open Model Railroad Network (OpenMRN)
|
A block of BarrierNotifiable objects, with an asynchronous allocation call. More...
#include <AsyncNotifiableBlock.hxx>
Classes | |
| class | QueuedBarrier |
| Notifiable class that can act as a BarrierNotifiable but also be enlisted in a queue. More... | |
Public Member Functions | |
| AsyncNotifiableBlock (unsigned num_parallelism) | |
| Constructor. | |
| ~AsyncNotifiableBlock () | |
| Destructor. | |
| BarrierNotifiable * | initialize (QMember *entry) |
| Turns an allocated entry from the QAsync into a usable BarrierNotifiable. | |
| void | notify () override |
| Notification implementation – should never be called. | |
Public Member Functions inherited from QAsync | |
| QAsync () | |
| Default Constructor. | |
| ~QAsync () | |
| Default destructor. | |
| void | insert (QMember *item, unsigned index=0) |
| Add an item to the back of the queue. | |
| void | next_async (Executable *flow) |
| Get an item from the front of the queue. | |
| QMember * | next (unsigned index) |
| Get an item from the front of the queue. | |
| Result | next () |
| Get an item from the front of the queue. | |
| Result | next_locked () |
| Get an item from the front of the queue. | |
| size_t | pending (unsigned index) |
| Get the number of pending items in the queue. | |
| size_t | pending () |
| Get the number of pending items in the queue. | |
| bool | empty (unsigned index) |
| Test if the queue is empty. | |
| bool | empty () |
| Test if the queue is empty. | |
Private Member Functions | |
| DISALLOW_COPY_AND_ASSIGN (AsyncNotifiableBlock) | |
Private Attributes | |
| unsigned | count_ |
| How many barriers do we have. | |
| std::unique_ptr< QueuedBarrier[]> | barriers_ |
| The pointer to the block of barriernotifiables. | |
A block of BarrierNotifiable objects, with an asynchronous allocation call.
Caller StateFlows can block on allocating a new entry, and then get back a fresh BarrierNotifiable, which, upon being released will automatically be reallocated to a waiting flow, if any.
Definition at line 53 of file AsyncNotifiableBlock.hxx.
|
inline |
Constructor.
| num_parallelism | tells how many BarrierNotifiables we should have and hand out to callers requesting them. |
Definition at line 95 of file AsyncNotifiableBlock.hxx.
| AsyncNotifiableBlock::~AsyncNotifiableBlock | ( | ) |
Destructor.
Definition at line 46 of file AsyncNotifiableBlock.cxx.
|
inline |
Turns an allocated entry from the QAsync into a usable BarrierNotifiable.
| entry | a QMember that was allocated from *this. |
Definition at line 114 of file AsyncNotifiableBlock.hxx.
|
inlineoverridevirtual |
Notification implementation – should never be called.
Implements Notifiable.
Definition at line 125 of file AsyncNotifiableBlock.hxx.
|
private |
The pointer to the block of barriernotifiables.
Definition at line 134 of file AsyncNotifiableBlock.hxx.
|
private |
How many barriers do we have.
Definition at line 132 of file AsyncNotifiableBlock.hxx.