Use a ListIterator to timerTick the components without holding the engine locked.
Fixes a large number of deadlocks. git-svn-id: http://yate.null.ro/svn/yate/trunk@3560 acf43c95-373e-0410-b603-e72c3f656dc1
This commit is contained in:
parent
9b69db8ee0
commit
17b6fc541b
|
@ -242,7 +242,7 @@ unsigned long SignallingComponent::tickSleep(unsigned long usec) const
|
|||
|
||||
SignallingEngine::SignallingEngine(const char* name)
|
||||
: Mutex(true,"SignallingEngine"),
|
||||
m_thread(0), m_listChanged(true),
|
||||
m_thread(0),
|
||||
m_usecSleep(DEF_TICK_SLEEP), m_tickSleep(0)
|
||||
{
|
||||
debugName(name);
|
||||
|
@ -438,18 +438,13 @@ unsigned long SignallingEngine::timerTick(const Time& when)
|
|||
{
|
||||
lock();
|
||||
m_tickSleep = m_usecSleep;
|
||||
m_listChanged = false;
|
||||
for (ObjList* l = &m_components; l; l = l->next()) {
|
||||
SignallingComponent* c = static_cast<SignallingComponent*>(l->get());
|
||||
if (c) {
|
||||
c->timerTick(when);
|
||||
// if the list was changed (can be only from this thread) we
|
||||
// break out and get back later - cheaper than using a ListIterator
|
||||
if (m_listChanged)
|
||||
break;
|
||||
}
|
||||
ListIterator iter(m_components);
|
||||
while (SignallingComponent* c = static_cast<SignallingComponent*>(iter.get())) {
|
||||
unlock();
|
||||
c->timerTick(when);
|
||||
lock();
|
||||
}
|
||||
unsigned long rval = m_listChanged ? 0 : m_tickSleep;
|
||||
unsigned long rval = m_tickSleep;
|
||||
m_tickSleep = m_usecSleep;
|
||||
unlock();
|
||||
return rval;
|
||||
|
|
|
@ -850,7 +850,6 @@ protected:
|
|||
|
||||
private:
|
||||
SignallingThreadPrivate* m_thread;
|
||||
bool m_listChanged;
|
||||
unsigned long m_usecSleep;
|
||||
unsigned long m_tickSleep;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue