[Libreoffice-commits] .: cppu/source

Stephan Bergmann sbergmann at kemper.freedesktop.org
Fri Feb 10 07:28:30 PST 2012


 cppu/source/threadpool/jobqueue.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit cba3ac1eab7acaf8e6efd7a00eee7c5e969fc49b
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Fri Feb 10 16:25:11 2012 +0100

    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().

diff --git a/cppu/source/threadpool/jobqueue.cxx b/cppu/source/threadpool/jobqueue.cxx
index 47418af..0864057 100644
--- a/cppu/source/threadpool/jobqueue.cxx
+++ b/cppu/source/threadpool/jobqueue.cxx
@@ -97,7 +97,9 @@ namespace cppu_threadpool {
                 if( 0 == m_lstCallstack.front() )
                 {
                     // disposed !
-                    if( m_lstJob.empty() )
+                    if( m_lstJob.empty()
+                        && (m_lstCallstack.empty()
+                            || m_lstCallstack.front() != 0) )
                     {
                         osl_resetCondition( m_cndWait );
                     }
@@ -110,7 +112,8 @@ namespace cppu_threadpool {
                     job = m_lstJob.front();
                     m_lstJob.pop_front();
                 }
-                if( m_lstJob.empty() )
+                if( m_lstJob.empty()
+                    && (m_lstCallstack.empty() || m_lstCallstack.front() != 0) )
                 {
                     osl_resetCondition( m_cndWait );
                 }


More information about the Libreoffice-commits mailing list