Skip to content

iox::popo::ConditionListener🔗

ConditionListener allows one to wait using a shared memory condition variable.

#include <condition_listener.hpp>

Public Types🔗

Name
using cxx::vector< cxx::BestFittingType_t< MAX_NUMBER_OF_NOTIFIERS_PER_CONDITION_VARIABLE >, MAX_NUMBER_OF_NOTIFIERS_PER_CONDITION_VARIABLE > NotificationVector_t

Public Functions🔗

Name
ConditionListener(ConditionVariableData & condVarData)
~ConditionListener() =default
ConditionListener(const ConditionListener & rhs)
ConditionListener(ConditionListener && rhs)
ConditionListener & operator=(const ConditionListener & rhs)
ConditionListener & operator=(ConditionListener && rhs)
bool wasNotified() const
Was the ConditionListener notified by a ConditionNotifier?
void destroy()
Used in classes to signal a thread which waits in wait() to return and stop working. Destroy will send an empty notification to wait() and after this call wait() turns into a non blocking call which always returns an empty vector.
NotificationVector_t wait()
returns a sorted vector of indices of active notifications; blocking if ConditionVariableData was not notified unless destroy() was called before. The indices of active notifications are never empty unless destroy() was called, then it's always empty.
NotificationVector_t timedWait(const units::Duration & timeToWait)
returns a sorted vector of indices of active notifications; blocking for the specified time if ConditionVariableData was not notified unless destroy() was called before. The indices of active notifications can be empty (spurious wakeups). When destroy() was called then it is always empty.

Protected Functions🔗

Name
const ConditionVariableData * getMembers() const
ConditionVariableData * getMembers()

Public Types Documentation🔗

using NotificationVector_t🔗

using iox::popo::ConditionListener::NotificationVector_t =  cxx::vector<cxx::BestFittingType_t<MAX_NUMBER_OF_NOTIFIERS_PER_CONDITION_VARIABLE>, MAX_NUMBER_OF_NOTIFIERS_PER_CONDITION_VARIABLE>;

Public Functions Documentation🔗

function ConditionListener🔗

explicit ConditionListener(
    ConditionVariableData & condVarData
)

function ~ConditionListener🔗

~ConditionListener() =default

function ConditionListener🔗

ConditionListener(
    const ConditionListener & rhs
)

function ConditionListener🔗

ConditionListener(
    ConditionListener && rhs
)

function operator=🔗

ConditionListener & operator=(
    const ConditionListener & rhs
)

function operator=🔗

ConditionListener & operator=(
    ConditionListener && rhs
)

function wasNotified🔗

bool wasNotified() const

Was the ConditionListener notified by a ConditionNotifier?

Return: true if it was notified otherwise false

function destroy🔗

void destroy()

Used in classes to signal a thread which waits in wait() to return and stop working. Destroy will send an empty notification to wait() and after this call wait() turns into a non blocking call which always returns an empty vector.

function wait🔗

NotificationVector_t wait()

returns a sorted vector of indices of active notifications; blocking if ConditionVariableData was not notified unless destroy() was called before. The indices of active notifications are never empty unless destroy() was called, then it's always empty.

Return: a sorted vector of active notifications

function timedWait🔗

NotificationVector_t timedWait(
    const units::Duration & timeToWait
)

returns a sorted vector of indices of active notifications; blocking for the specified time if ConditionVariableData was not notified unless destroy() was called before. The indices of active notifications can be empty (spurious wakeups). When destroy() was called then it is always empty.

Parameters:

  • timeToWait duration how long at most this method should wait

Return: a sorted vector of active notifications

Protected Functions Documentation🔗

function getMembers🔗

const ConditionVariableData * getMembers() const

function getMembers🔗

ConditionVariableData * getMembers()

Updated on 17 June 2021 at 11:15:27 CEST