FARGOS/VISTA Object Management Environment Core
..
|
Generic mutex implementation that supports timing statistics. More...
#include <timed_mutex.hpp>
Classes | |
class | TimedMutexStatistics |
Statistics for a TimedMutex object. More... | |
Public Member Functions | |
TimedMutex (const char *lockName, SharedMemoryVariableNode *parentNode, bool recursive=false) | |
Implements generic mutex with performance counters. More... | |
TimedMutex (const char *lockName=nullptr, SharedMemoryVariableManager *mgr=&DEFAULT_sharedMemoryVariableManager, bool recursive=false) | |
Implements generic mutex with performance counters. More... | |
~TimedMutex () | |
int64_t | lock (const char *place=nullptr) OME_ALWAYS_INLINE |
Lock the mutex. More... | |
int64_t | untimedLock () OME_ALWAYS_INLINE |
Lock the mutex, but maintain neither usage nor timing statistics. More... | |
int64_t | unlock () |
Release a previously locked mutex. More... | |
int64_t | untimedUnlock () OME_ALWAYS_INLINE |
Unlock the mutex, but maintain neither usage nor timing statistics. More... | |
OME_MUTEX_TYPE * | mutex_address () OME_ALWAYS_INLINE NONNULL_RETURN |
Get address of underlying native mutex. More... | |
const char * | getMutexName () const NONNULL_RETURN |
Return name of mutex. More... | |
uint64_t | getThreadIdOfCurrentOwner () const OME_ALWAYS_INLINE |
Return thread id of thread holding lock. More... | |
Protected Member Functions | |
int64_t | acquireLock () |
Protected Attributes | |
TimedMutexStatistics * | statistics |
uint64_t | obtainedAt |
OME_MUTEX_TYPE | mutex |
Friends | |
class | TimedCondition |
Generic mutex implementation that supports timing statistics.
|
explicit |
Implements generic mutex with performance counters.
lockName | is a user-provided name to label the lock. If a null pointer, no statistics will be maintained. |
parentNode | specifies a root under which any SharedMemoryVariable counters should be registered. |
recursive | indicates if a recursive lock is desired. |
References mutex, obtainedAt, PTHREAD_MUTEX_RECURSIVE, and statistics.
|
explicit |
Implements generic mutex with performance counters.
lockName | is a user-provided name to label the lock. If a null pointer, no statistics will be maintained. |
mgr | specifies SharedMemoryVariableManager to which the counters should be registered. |
recursive | indicates if a recursive lock is desired. |
References mutex, obtainedAt, PTHREAD_MUTEX_RECURSIVE, and statistics.
TimedMutex::~TimedMutex | ( | ) |
References mutex, and statistics.
|
protected |
References get_CPU_ticks(), TimedMutex::TimedMutexStatistics::lockHeldBy, TimedMutex::TimedMutexStatistics::lockObtainedAt, TimedMutex::TimedMutexStatistics::lockRequestedAt, TimedMutex::TimedMutexStatistics::locksObtained, TimedMutex::TimedMutexStatistics::locksWanted, mutex, obtainedAt, OME_EXPECT_TRUE, statistics, and TimedMutex::TimedMutexStatistics::totalDelayTicks.
Referenced by lock().
|
inline |
Return name of mutex.
TimedMutex | will be returned if the name was never set; this will never return a null pointer. |
References SharedMemoryVariable::getName(), TimedMutex::TimedMutexStatistics::namingNode, and statistics.
|
inline |
Return thread id of thread holding lock.
0 | indicates either no thread is holding the lock or it was not remembered because statistics are not available. |
References TimedMutex::TimedMutexStatistics::lockHeldBy, and statistics.
|
inline |
Lock the mutex.
place | specifies the location in readable form. |
References acquireLock(), TimedMutex::TimedMutexStatistics::lockLocation, and statistics.
Referenced by TimedCondition::lock(), TimedCondition::waitForCondition(), and TimedCondition::waitForConditionOrUntil().
|
inline |
Get address of underlying native mutex.
References mutex.
Referenced by TimedCondition::mutex_address(), TimedCondition::waitForCondition(), and TimedCondition::waitForConditionOrUntil().
int64_t TimedMutex::unlock | ( | ) |
Release a previously locked mutex.
References get_CPU_ticks(), TimedMutex::TimedMutexStatistics::lockHeldBy, mutex, obtainedAt, statistics, and TimedMutex::TimedMutexStatistics::totalHeldTicks.
Referenced by HTTPstatusLog::addHTTPsession(), IO_Processor::doProcessLoop(), HTTPstatusLog::dumpEventsFromTime(), HTTPstatusLog::findOrCreateEventRecord(), TimePointCacheTable::getCacheEntry(), HTTPstatusLog::locateEventRecord(), IO_Processor::noteDataToProcess(), HTTPstatusLog::publishEventState(), HTTPstatusLog::publishKeepAlive(), HTTPstatusLog::removeHTTPsession(), TimedCondition::unlock(), TimedCondition::waitForCondition(), TimedCondition::waitForConditionOrUntil(), IO_Processor::waitForDataToProcess(), and IO_Processor::waitForDataToProcessOrUntil().
|
inline |
Lock the mutex, but maintain neither usage nor timing statistics.
0 | is always returned. |
References mutex.
Referenced by TimedCondition::untimedLock(), and TimedCondition::untimedUnlock().
|
inline |
Unlock the mutex, but maintain neither usage nor timing statistics.
0 | is always returned. |
References mutex.
|
friend |
|
protected |
Referenced by acquireLock(), mutex_address(), TimedMutex(), unlock(), untimedLock(), untimedUnlock(), and ~TimedMutex().
|
protected |
Referenced by acquireLock(), TimedMutex(), and unlock().
|
protected |
Referenced by acquireLock(), getMutexName(), getThreadIdOfCurrentOwner(), lock(), TimedMutex(), unlock(), and ~TimedMutex().
![]() | Generated: Fri Jul 31 2020 18:19:16
Support Information |