Avoid deadlocks when disposing recursive JobQueue::enter

...where the outer JobQueue::enter blocks on m_cndWait after it has been reset
again due to m_lstJob.empty().
This commit is contained in:
Stephan Bergmann
2012-02-10 16:25:11 +01:00
parent 739100d0ab
commit cba3ac1eab

View File

@@ -97,7 +97,9 @@ namespace cppu_threadpool {
if( 0 == m_lstCallstack.front() ) if( 0 == m_lstCallstack.front() )
{ {
// disposed ! // disposed !
if( m_lstJob.empty() ) if( m_lstJob.empty()
&& (m_lstCallstack.empty()
|| m_lstCallstack.front() != 0) )
{ {
osl_resetCondition( m_cndWait ); osl_resetCondition( m_cndWait );
} }
@@ -110,7 +112,8 @@ namespace cppu_threadpool {
job = m_lstJob.front(); job = m_lstJob.front();
m_lstJob.pop_front(); m_lstJob.pop_front();
} }
if( m_lstJob.empty() ) if( m_lstJob.empty()
&& (m_lstCallstack.empty() || m_lstCallstack.front() != 0) )
{ {
osl_resetCondition( m_cndWait ); osl_resetCondition( m_cndWait );
} }