ALib C++ Framework
by
Library Version: 2511 R0
Documentation generated by doxygen
Loading...
Searching...
No Matches
alib::threads::Event 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 340 of file condition.inl.

Inheritance diagram for alib::threads::Event:
alib::threads::TCondition< Event >

Public Method Index:

 Event (const character *dbgName)
void Reset (ALIB_DBG_TAKE_CI)
void ResetAndWait (ALIB_DBG_TAKE_CI)
void ResetAndWait (const Ticks &wakeUpTime, const CallerInfo &ci)
void ResetAndWait (const Ticks::Duration &maxWaitTimeSpan, const CallerInfo &ci)
void ResetAndWait (const Ticks::Duration::TDuration &maxWaitTimeSpan, const CallerInfo &ci)
void Set (ALIB_DBG_TAKE_CI)
void SetAll (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< Event >
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< Event >
 TCondition (const character *dbgName)
void Acquire (ALIB_DBG_TAKE_CI)
Eventcast ()
void Release (ALIB_DBG_TAKE_CI)
void ReleaseAndNotify (ALIB_DBG_TAKE_CI)
void ReleaseAndNotifyAll (ALIB_DBG_TAKE_CI)
void WaitForNotification (ALIB_DBG_TAKE_CI)

Field Details:

◆ notified

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

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

Definition at line 349 of file condition.inl.

Constructor(s) / Destructor Details:

◆ Event()

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

Defaulted default constructor.

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

Definition at line 367 of file condition.inl.

Method Details:

◆ isConditionMet()

bool alib::threads::Event::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 355 of file condition.inl.

◆ Reset()

void alib::threads::Event::Reset ( ALIB_DBG_TAKE_CI )
inline

Resets the condition (flag becomes false). No notification is sent.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 393 of file condition.inl.

◆ ResetAndWait() [1/4]

void alib::threads::Event::ResetAndWait ( ALIB_DBG_TAKE_CI )
inline

Clears the condition first and then waits (for an unlimited time). This provides edge-triggered semantics comparable to the previous implementation of Wait.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 418 of file condition.inl.

◆ ResetAndWait() [2/4]

void alib::threads::Event::ResetAndWait ( const Ticks & wakeUpTime,
const CallerInfo & ci )
inline

Clears the condition first and then waits until a given point in time.

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

Definition at line 515 of file condition.inl.

◆ ResetAndWait() [3/4]

void alib::threads::Event::ResetAndWait ( const Ticks::Duration & maxWaitTimeSpan,
const CallerInfo & ci )
inline

Clears the condition first and then waits for up to a given duration.

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

Definition at line 483 of file condition.inl.

◆ ResetAndWait() [4/4]

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

Clears the condition first and then waits for up to a given duration.

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

Definition at line 447 of file condition.inl.

◆ Set()

void alib::threads::Event::Set ( ALIB_DBG_TAKE_CI )
inline

Sets the condition (flag becomes true) and wakes up the next sleeping thread.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 375 of file condition.inl.

◆ SetAll()

void alib::threads::Event::SetAll ( ALIB_DBG_TAKE_CI )
inline

Sets the condition (flag becomes true) and wakes up all sleeping threads.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 384 of file condition.inl.

◆ Wait() [1/4]

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

Waits until the condition is set (for an unlimited time). This method does not modify the condition state.

Debug Parameter:
Pass macro ALIB_CALLER_PRUNED with invocations.

Definition at line 403 of file condition.inl.

◆ Wait() [2/4]

void alib::threads::Event::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 the macro ALIB_COMMA_CALLER_PRUNED with invocations. Waits until the condition is set, but only until a given point in time. This method does not modify the condition state.

Definition at line 505 of file condition.inl.

◆ Wait() [3/4]

void alib::threads::Event::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 the macro ALIB_COMMA_CALLER_PRUNED with invocations.

Definition at line 476 of file condition.inl.

◆ Wait() [4/4]

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

Same as Wait(const Ticks::Duration&, const CallerInfo&), but only up to a given duration. This method does not modify the condition state.

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

Definition at line 437 of file condition.inl.


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