diff options
author | Michael Meeks <michael.meeks@collabora.com> | 2014-10-30 21:58:36 +0000 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2014-10-30 22:12:29 +0000 |
commit | 593a44a12dbdc00a9f116efc754e3e17dff5dec6 (patch) | |
tree | 821e63780edb644efcfe6a9f0ee6bb077b5f6fa5 /comphelper | |
parent | 62090f65b804a08a66ca26675ae610ed07c7c341 (diff) |
thread-pool: re-work termination semantics to avoid problems.
We want a pre-spun-up, shared thread-pool that doesn't get its
workers created & joined frequently.
Change-Id: I29081e3a3e3849ca30e63fd080ee3315d99cbe8d
Diffstat (limited to 'comphelper')
-rw-r--r-- | comphelper/source/misc/threadpool.cxx | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx index d2101ada54d2..236a314019f8 100644 --- a/comphelper/source/misc/threadpool.cxx +++ b/comphelper/source/misc/threadpool.cxx @@ -92,7 +92,7 @@ ThreadPool::ThreadPool( sal_Int32 nWorkers ) : ThreadPool::~ThreadPool() { - waitUntilWorkersDone(); + waitAndCleanupWorkers(); } struct ThreadPoolStatic : public rtl::StaticWithInit< boost::shared_ptr< ThreadPool >, @@ -109,9 +109,7 @@ ThreadPool& ThreadPool::getSharedOptimalPool() return *ThreadPoolStatic::get().get(); } -/// wait until all the workers have completed and -/// terminate all threads -void ThreadPool::waitUntilWorkersDone() +void ThreadPool::waitAndCleanupWorkers() { waitUntilEmpty(); @@ -169,7 +167,6 @@ void ThreadPool::waitUntilEmpty() pTask->doWork(); delete pTask; } - mbTerminate = true; } else { |