Lock the debug mutex only if we have something to show.

git-svn-id: http://voip.null.ro/svn/yate@3191 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
marian 2010-04-14 08:59:44 +00:00
parent 6bdf413a19
commit a9028c067d
1 changed files with 7 additions and 5 deletions

View File

@ -1974,11 +1974,13 @@ void Client::line(int newLine)
// actions taken when the client is idle, has nothing to do
void Client::idleActions()
{
s_debugMutex.lock();
NamedList* log = s_debugLog;
s_debugLog = 0;
s_debugMutex.unlock();
// add to the debug log new information
NamedList* log = 0;
if (s_debugLog && s_debugMutex.lock(20000)) {
log = s_debugLog;
s_debugLog = 0;
s_debugMutex.unlock();
}
// Add to the debug log new information
if (log) {
addLines(s_debugWidget,log,s_eventLen);
TelEngine::destruct(log);