ALib C++ Library
Library Version: 2412 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
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.4 Collecting Caller Information of the General Programmer's Manual.

Definition at line 468 of file condition.hpp.

#include <condition.hpp>

Inheritance diagram for Condition:
[legend]
Collaboration diagram for 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 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 TCondition< Condition >
 TCondition (const String &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 432 of file condition.hpp.

Field Details:

◆ notified

bool notified = false
protected

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

Definition at line 475 of file condition.hpp.

Constructor(s) / Destructor Details:

◆ Condition()

Condition ( const character * dbgName)
inline

Defaulted default constructor.

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

Definition at line 493 of file condition.hpp.

Method Details:

◆ isConditionMet()

bool 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 481 of file condition.hpp.

◆ Notify()

void Notify ( ALIB_DBG_TAKE_CI )
inline

Wakes up the next sleeping thread.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 501 of file condition.hpp.

◆ NotifyAll()

void NotifyAll ( ALIB_DBG_TAKE_CI )
inline

Wakes up all sleeping threads.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 511 of file condition.hpp.

◆ Wait() [1/4]

void 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 521 of file condition.hpp.

◆ Wait() [2/4]

void 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 591 of file condition.hpp.

◆ Wait() [3/4]

void 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 572 of file condition.hpp.

◆ Wait() [4/4]

void 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 544 of file condition.hpp.


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