From 6abf16e6ed4def8bcd77e32ccd3ee8518ffe5dd2 Mon Sep 17 00:00:00 2001 From: Gunnar Beutner Date: Thu, 31 Oct 2013 19:09:51 +0100 Subject: [PATCH] Fix deadlock in ThreadPool::Join. Refs #4986 --- lib/base/threadpool.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/base/threadpool.cpp b/lib/base/threadpool.cpp index 942da06e5..71e5aad54 100644 --- a/lib/base/threadpool.cpp +++ b/lib/base/threadpool.cpp @@ -236,7 +236,8 @@ void ThreadPool::ManagerThreadProc(void) { boost::mutex::scoped_lock lock(m_Mutex); - m_MgmtCV.timed_wait(lock, boost::posix_time::seconds(5)); + if (!m_Stopped) + m_MgmtCV.timed_wait(lock, boost::posix_time::seconds(5)); if (m_Stopped) break; @@ -345,7 +346,8 @@ void ThreadPool::StatsThreadProc(void) for (;;) { boost::mutex::scoped_lock lock(m_Mutex); - m_MgmtCV.timed_wait(lock, boost::posix_time::milliseconds(250)); + if (!m_Stopped) + m_MgmtCV.timed_wait(lock, boost::posix_time::milliseconds(250)); if (m_Stopped) break;