ALib C++ Library
Library Version: 2510 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::threads::Condition Class Reference

Description:

Extends "abstract template type" TCondition. This implementation constitutes the simplest possible derivate, by

  1. holding just a boolean member, and
  2. by providing a similar generic interface.
    See also
    Chapter A.5 Collecting Caller Information of the General Programmer's Manual.

Definition at line 356 of file condition.inl.

Inheritance diagram for alib::threads::Condition:
[legend]
Collaboration diagram for alib::threads::Condition:
[legend]

Public Method Index:

 Condition (const character *dbgName)
 
void Notify (ALIB_DBG_TAKE_CI)
 
void NotifyAll (ALIB_DBG_TAKE_CI)
 
void Wait (ALIB_DBG_TAKE_CI)
 
void Wait (const Ticks &wakeUpTime, const CallerInfo &ci)
 
void Wait (const Ticks::Duration &maxWaitTimeSpan, const CallerInfo &ci)
 
void Wait (const Ticks::Duration::TDuration &maxWaitTimeSpan, const CallerInfo &ci)
 

Protected Field Index:

bool notified = false
 Boolean member which records notifications. Defaults to not-notified.
 
- Protected Field Index: inherited from alib::threads::TCondition< Condition >
std::condition_variable conditionVariable
 The condition variable used for blocking and notification.
 
DbgConditionAsserter Dbg
 The debug tool instance.
 
std::mutex mutex
 The mutex used for locking this instance.
 

Protected Method Index:

bool isConditionMet ()
 
- Protected Method Index: inherited from alib::threads::TCondition< Condition >
 TCondition (const character *dbgName)
 
void Acquire (ALIB_DBG_TAKE_CI)
 
Conditioncast ()
 
void Release (ALIB_DBG_TAKE_CI)
 
void ReleaseAndNotify (ALIB_DBG_TAKE_CI)
 
void ReleaseAndNotifyAll (ALIB_DBG_TAKE_CI)
 
void WaitForNotification (ALIB_DBG_TAKE_CI)
 
void WaitForNotification (const Ticks &wakeUpTime, const CallerInfo &ci)
 
void WaitForNotification (const Ticks::Duration &maxWaitTimeSpan, const CallerInfo &ci)
 
void WaitForNotification (const Ticks::Duration::TDuration &maxWaitTimeSpan, const CallerInfo &ci)
 

Friends And Related Entity Details:

◆ TCondition< Condition >

friend struct TCondition< Condition >
friend

the parent type needs to be able to call protected method isConditionMet.

Definition at line 320 of file condition.inl.

Field Details:

◆ notified

bool alib::threads::Condition::notified = false
protected

Boolean member which records notifications. Defaults to not-notified.

Definition at line 363 of file condition.inl.

Constructor(s) / Destructor Details:

◆ Condition()

alib::threads::Condition::Condition ( const character * dbgName)
inline

Defaulted default constructor.

Parameters
dbgNameA name for the condition. Only available with debug-compilations.

Definition at line 381 of file condition.inl.

Here is the call graph for this function:

Method Details:

◆ isConditionMet()

bool alib::threads::Condition::isConditionMet ( )
inlineprotected

In general, derivates of TCondition have to return true if the former reason for blocking a thread is now fulfilled.

Returns
This implementation returns the value of field member notified.

Definition at line 369 of file condition.inl.

◆ Notify()

void alib::threads::Condition::Notify ( ALIB_DBG_TAKE_CI )
inline

Wakes up the next sleeping thread.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 389 of file condition.inl.

Here is the call graph for this function:

◆ NotifyAll()

void alib::threads::Condition::NotifyAll ( ALIB_DBG_TAKE_CI )
inline

Wakes up all sleeping threads.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 399 of file condition.inl.

Here is the call graph for this function:

◆ Wait() [1/4]

void alib::threads::Condition::Wait ( ALIB_DBG_TAKE_CI )
inline

Waits for notification (for an unlimited time).

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 409 of file condition.inl.

Here is the call graph for this function:

◆ Wait() [2/4]

void alib::threads::Condition::Wait ( const Ticks & wakeUpTime,
const CallerInfo & ci )
inline

Waits for notification, but only until a given point in time.

Before invoking this method, this object has to be acquired. After the wake-up call, the internal mutex is (again) acquired and thus has to be released later.

Parameters
wakeUpTimeThe point in time to wake up, even if not notified.
ciCaller information. Use macro ALIB_COMMA_CALLER_PRUNED with invocations.

Definition at line 479 of file condition.inl.

Here is the call graph for this function:

◆ Wait() [3/4]

void alib::threads::Condition::Wait ( const Ticks::Duration & maxWaitTimeSpan,
const CallerInfo & ci )
inline

Waits for notification but only for a given duration.

Before invoking this method, this object has to be acquired. After the wake-up call, the internal mutex is (again) acquired and thus has to be released later.

Parameters
maxWaitTimeSpanThe maximum time to wait.
ciCaller information. Use macro ALIB_COMMA_CALLER_PRUNED with invocations.

Definition at line 460 of file condition.inl.

Here is the call graph for this function:

◆ Wait() [4/4]

void alib::threads::Condition::Wait ( const Ticks::Duration::TDuration & maxWaitTimeSpan,
const CallerInfo & ci )
inline

Same as Wait(const Ticks::Duration&, const CallerInfo&), but takes a C++ time span.

Parameters
maxWaitTimeSpanThe maximum time to wait.
ciCaller information. Use macro ALIB_COMMA_CALLER_PRUNED with invocations.

Definition at line 432 of file condition.inl.

Here is the call graph for this function:

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