FARGOS/VISTA Object Management Environment Core
..
|
Generic condition variable for use with the TimedMutex class. More...
#include <timed_mutex.hpp>
Classes | |
class | TimedConditionStatistics |
Statistics for a TimedCondition object. More... | |
Public Member Functions | |
TimedCondition (TimedMutex *m, const char *conditionName, SharedMemoryVariableNode *parentNode) NONNULL_CLASS_PARAMETERS(2) | |
Implements generic condition variable with performance counters. More... | |
TimedCondition (TimedMutex *m, const char *conditionName=nullptr, SharedMemoryVariableManager *mgr=&DEFAULT_sharedMemoryVariableManager) NONNULL_CLASS_PARAMETERS(2) | |
Implements generic condition variable with performance counters. More... | |
~TimedCondition () | |
TimedMutex * | getMutex () const OME_ALWAYS_INLINE NONNULL_RETURN |
Return address of mutex object associated with the condition variable. More... | |
OME_CONDITION_TYPE * | condition_address () OME_ALWAYS_INLINE NONNULL_RETURN |
Get address of underlying native condition variable. More... | |
int64_t | waitForCondition (const char *waitingHere=nullptr) |
Wait indefinitely for the condition to be posted. More... | |
int64_t | waitForConditionOrUntil (const struct timespec *timeout, const char *waitingHere=nullptr) NONNULL_CLASS_PARAMETERS(2) |
Wait for the condition to be posted or until a specified point in time. More... | |
int | postCondition () |
Notify any sleeping threads that the condition has occurred. More... | |
bool | isSleeping () const OME_ALWAYS_INLINE |
Return a Boolean indication of whether or not a thread is sleeping. More... | |
const char * | getConditionName () const NONNULL_RETURN |
Return name of condition variable. More... | |
int64_t | lock (const char *place=nullptr) OME_ALWAYS_INLINE |
Convenience routine to lock the associated mutex. More... | |
int64_t | untimedLock () OME_ALWAYS_INLINE |
Convenience routine to lock the associated mutex, but maintain neither usage nor timing statistics. More... | |
int64_t | unlock () OME_ALWAYS_INLINE |
Convenience routine to release previously locked mutex associated with the condition variable. More... | |
int64_t | untimedUnlock () OME_ALWAYS_INLINE |
Convenience routine to unlock the mutex associated with the condition variable, but maintain neither usage nor timing statistics. More... | |
OME_MUTEX_TYPE * | mutex_address () OME_ALWAYS_INLINE NONNULL_RETURN |
Convenience routine to get address of underlying native mutex that is associated with the condition variable. More... | |
Protected Attributes | |
TimedConditionStatistics * | statistics |
uint64_t | startedAt |
TimedMutex * | mutex |
OME_CONDITION_TYPE | condition |
bool | active |
Generic condition variable for use with the TimedMutex class.
|
explicit |
Implements generic condition variable with performance counters.
m | is an existing mutex to be associated with the condition variable. It is expected to be locked before calling waitForCondition() or waitForConditionOrUntil(). |
conditionName | is a user-provided name to label the condition. If a null pointer, no statistics will be maintained. |
parentNode | specifies a root under which any SharedMemoryVariable counters should be registered. |
References active, condition, mutex, NULL, startedAt, and statistics.
|
explicit |
Implements generic condition variable with performance counters.
m | is an existing mutex to be associated with the condition variable. It is expected to be locked before calling waitForCondition() or waitForConditionOrUntil(). |
conditionName | is a user-provided name to label the condition. If a null pointer, no statistics will be maintained. |
mgr | specifies SharedMemoryVariableManager to which the counters should be registered. |
References active, condition, mutex, NULL, startedAt, and statistics.
TimedCondition::~TimedCondition | ( | ) |
References condition, and statistics.
|
inline |
Get address of underlying native condition variable.
References condition.
|
inline |
Return name of condition variable.
TimedCondition | is returned if the name was never set; this routine will never return a null pointer. |
References SharedMemoryVariable::getName(), TimedCondition::TimedConditionStatistics::namingNode, and statistics.
|
inline |
Return address of mutex object associated with the condition variable.
References mutex.
|
inline |
Return a Boolean indication of whether or not a thread is sleeping.
References active.
Referenced by IO_Processor::noteDataToProcess().
|
inline |
Convenience routine to lock the associated mutex.
place | specifies the location in readable form. |
References TimedMutex::lock(), and mutex.
|
inline |
Convenience routine to get address of underlying native mutex that is associated with the condition variable.
References mutex, and TimedMutex::mutex_address().
int TimedCondition::postCondition | ( | ) |
Notify any sleeping threads that the condition has occurred.
0 | is always returned |
References condition, statistics, and TimedCondition::TimedConditionStatistics::totalPostEvents.
Referenced by IO_Processor::noteDataToProcess().
|
inline |
Convenience routine to release previously locked mutex associated with the condition variable.
References mutex, and TimedMutex::unlock().
|
inline |
Convenience routine to lock the associated mutex, but maintain neither usage nor timing statistics.
0 | is always returned. |
References mutex, and TimedMutex::untimedLock().
|
inline |
Convenience routine to unlock the mutex associated with the condition variable, but maintain neither usage nor timing statistics.
0 | is always returned. |
References mutex, and TimedMutex::untimedLock().
int64_t TimedCondition::waitForCondition | ( | const char * | waitingHere = nullptr | ) |
Wait indefinitely for the condition to be posted.
waitingHere | specifies the location of the call. See WAIT_HERE(). |
The | duration of the wait in nanoseconds is returned. |
References active, condition, get_CPU_ticks(), TimedMutex::lock(), mutex, TimedMutex::mutex_address(), startedAt, statistics, TimedCondition::TimedConditionStatistics::totalWaitTicks, TimedMutex::unlock(), TimedCondition::TimedConditionStatistics::waitCompletedAt, TimedCondition::TimedConditionStatistics::waitLocation, TimedCondition::TimedConditionStatistics::waitsCompleted, TimedCondition::TimedConditionStatistics::waitsStarted, and TimedCondition::TimedConditionStatistics::waitStartedAt.
int64_t TimedCondition::waitForConditionOrUntil | ( | const struct timespec * | timeout, |
const char * | waitingHere = nullptr |
||
) |
Wait for the condition to be posted or until a specified point in time.
timeout | specifies a point in time after which the routine will return. This is not a difference in time relative to the invocation of the function call, but instead an absolute point in time. |
waitingHere | specifies the location of the call. See WAIT_HERE(). |
The | duration of the wait in nanoseconds is returned. |
References active, clock_gettime_via_tick(), condition, get_CPU_ticks(), TimedMutex::lock(), mutex, TimedMutex::mutex_address(), startedAt, statistics, TimedCondition::TimedConditionStatistics::totalWaitTicks, TimedMutex::unlock(), TimedCondition::TimedConditionStatistics::waitCompletedAt, TimedCondition::TimedConditionStatistics::waitLocation, TimedCondition::TimedConditionStatistics::waitsCompleted, TimedCondition::TimedConditionStatistics::waitsStarted, and TimedCondition::TimedConditionStatistics::waitStartedAt.
|
protected |
Referenced by isSleeping(), TimedCondition(), waitForCondition(), and waitForConditionOrUntil().
|
protected |
Referenced by condition_address(), postCondition(), TimedCondition(), waitForCondition(), waitForConditionOrUntil(), and ~TimedCondition().
|
protected |
Referenced by getMutex(), lock(), mutex_address(), TimedCondition(), unlock(), untimedLock(), untimedUnlock(), waitForCondition(), and waitForConditionOrUntil().
|
protected |
Referenced by TimedCondition(), waitForCondition(), and waitForConditionOrUntil().
|
protected |
Referenced by getConditionName(), postCondition(), TimedCondition(), waitForCondition(), waitForConditionOrUntil(), and ~TimedCondition().
![]() | Generated: Fri Jul 31 2020 18:19:16
Support Information |