Return -1 to the Mutex or Semaphore count if they are not counted (started without -Dd).

Don't include them in Engine status if not counted.


git-svn-id: http://yate.null.ro/svn/yate/trunk@5545 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
paulc 2013-06-14 13:08:30 +00:00
parent 03618a32ff
commit 2cf95d0cf8
3 changed files with 10 additions and 6 deletions

View File

@ -424,9 +424,13 @@ bool EngineStatusHandler::received(Message &msg)
msg.retValue() << ",threads=" << Thread::count();
msg.retValue() << ",workers=" << EnginePrivate::count;
msg.retValue() << ",mutexes=" << Mutex::count();
msg.retValue() << ",locks=" << Mutex::locks();
int locks = Mutex::locks();
if (locks >= 0)
msg.retValue() << ",locks=" << locks;
msg.retValue() << ",semaphores=" << Semaphore::count();
msg.retValue() << ",waiting=" << Semaphore::locks();
locks = Semaphore::locks();
if (locks >= 0)
msg.retValue() << ",waiting=" << locks;
msg.retValue() << ",acceptcalls=" << lookup(Engine::accept(),Engine::getCallAcceptStates());
if (msg.getBoolValue("details",true)) {
NamedIterator iter(Engine::runParams());

View File

@ -611,7 +611,7 @@ int Mutex::count()
int Mutex::locks()
{
return MutexPrivate::s_locks;
return s_safety ? MutexPrivate::s_locks : -1;
}
bool Mutex::efficientTimedLock()
@ -710,7 +710,7 @@ int Semaphore::count()
int Semaphore::locks()
{
return SemaphorePrivate::s_locks;
return s_safety ? SemaphorePrivate::s_locks : -1;
}
bool Semaphore::efficientTimedLock()

View File

@ -4514,7 +4514,7 @@ public:
/**
* Get the number of currently locked mutexes
* @return Count of locked mutexes, should be zero at program exit
* @return Count of locked mutexes, -1 if unknown (not tracked)
*/
static int locks();
@ -4649,7 +4649,7 @@ public:
/**
* Get the number of currently locked (waiting) semaphores
* @return Count of locked semaphores, should be zero at program exit
* @return Count of locked semaphores, -1 if unknown (not tracked)
*/
static int locks();