Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
BlockOrWakeUp< Critical >::LockHolder Struct Reference

RAII class for holding a mutex lock that can be upgraded to a critical section lock. More...

#include <BlockOrWakeUp.hxx>

Public Member Functions

 LockHolder (BlockOrWakeUp< Critical > *parent)
 Constructor.
 
 LockHolder (LockHolder &&o)
 Move constructor.
 
CriticalHolder critical ()
 upgrades a regular lock to a critical section.
 
void wait_for_notification ()
 Waits for the core condition to be true (i.e.
 
void notify_next ()
 Hands over the core condition to a next someone waiting in line.
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (LockHolder)
 

Private Attributes

BlockOrWakeUp< Critical > * parent_
 Parent object whose lock we are holding.
 

Detailed Description

template<class Critical>
struct BlockOrWakeUp< Critical >::LockHolder

RAII class for holding a mutex lock that can be upgraded to a critical section lock.

Definition at line 116 of file BlockOrWakeUp.hxx.

Constructor & Destructor Documentation

◆ LockHolder() [1/2]

template<class Critical >
BlockOrWakeUp< Critical >::LockHolder::LockHolder ( BlockOrWakeUp< Critical > *  parent)
inline

Constructor.

As a side effect acquires a regular (non-critical) lock.

Parameters
parentwhich object to lock.

Definition at line 120 of file BlockOrWakeUp.hxx.

◆ LockHolder() [2/2]

template<class Critical >
BlockOrWakeUp< Critical >::LockHolder::LockHolder ( LockHolder &&  o)
inline

Move constructor.

Parameters
oc++ movable object.

Definition at line 127 of file BlockOrWakeUp.hxx.

◆ ~LockHolder()

template<class Critical >
BlockOrWakeUp< Critical >::LockHolder::~LockHolder ( )
inline

Definition at line 133 of file BlockOrWakeUp.hxx.

Member Function Documentation

◆ critical()

template<class Critical >
CriticalHolder BlockOrWakeUp< Critical >::LockHolder::critical ( )
inline

upgrades a regular lock to a critical section.

Returns
a lock holder for the critical section.

Definition at line 143 of file BlockOrWakeUp.hxx.

◆ notify_next()

template<class Critical >
void BlockOrWakeUp< Critical >::LockHolder::notify_next ( )
inline

Hands over the core condition to a next someone waiting in line.

Definition at line 159 of file BlockOrWakeUp.hxx.

◆ wait_for_notification()

template<class Critical >
void BlockOrWakeUp< Critical >::LockHolder::wait_for_notification ( )
inline

Waits for the core condition to be true (i.e.

data available for read or space available to write data to). Blocks caller.

Definition at line 151 of file BlockOrWakeUp.hxx.

Member Data Documentation

◆ parent_

template<class Critical >
BlockOrWakeUp<Critical>* BlockOrWakeUp< Critical >::LockHolder::parent_
private

Parent object whose lock we are holding.

Definition at line 176 of file BlockOrWakeUp.hxx.


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