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

A block of BarrierNotifiable objects, with an asynchronous allocation call. More...

#include <AsyncNotifiableBlock.hxx>

Inheritance diagram for AsyncNotifiableBlock:
Notifiable QAsync

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.
 
BarrierNotifiableinitialize (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.
 
QMembernext (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.
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ AsyncNotifiableBlock()

AsyncNotifiableBlock::AsyncNotifiableBlock ( unsigned  num_parallelism)
inline

Constructor.

Parameters
num_parallelismtells how many BarrierNotifiables we should have and hand out to callers requesting them.

Definition at line 95 of file AsyncNotifiableBlock.hxx.

◆ ~AsyncNotifiableBlock()

AsyncNotifiableBlock::~AsyncNotifiableBlock ( )

Destructor.

Definition at line 46 of file AsyncNotifiableBlock.cxx.

Member Function Documentation

◆ initialize()

BarrierNotifiable * AsyncNotifiableBlock::initialize ( QMember entry)
inline

Turns an allocated entry from the QAsync into a usable BarrierNotifiable.

Parameters
entrya QMember that was allocated from *this.
Returns
an initialized BarrierNotifiable with exactly one count, and done_ set up to be returned for further use.

Definition at line 114 of file AsyncNotifiableBlock.hxx.

◆ notify()

void AsyncNotifiableBlock::notify ( )
inlineoverridevirtual

Notification implementation – should never be called.

Implements Notifiable.

Definition at line 125 of file AsyncNotifiableBlock.hxx.

Member Data Documentation

◆ barriers_

std::unique_ptr<QueuedBarrier[]> AsyncNotifiableBlock::barriers_
private

The pointer to the block of barriernotifiables.

Definition at line 134 of file AsyncNotifiableBlock.hxx.

◆ count_

unsigned AsyncNotifiableBlock::count_
private

How many barriers do we have.

Definition at line 132 of file AsyncNotifiableBlock.hxx.


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