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 /include | |
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 'include')
-rw-r--r-- | include/comphelper/threadpool.hxx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/comphelper/threadpool.hxx b/include/comphelper/threadpool.hxx index ae103f1164f1..2e5171902f55 100644 --- a/include/comphelper/threadpool.hxx +++ b/include/comphelper/threadpool.hxx @@ -39,14 +39,19 @@ public: ThreadPool( sal_Int32 nWorkers ); virtual ~ThreadPool(); + /// push a new task onto the work queue void pushTask( ThreadTask *pTask /* takes ownership */ ); + + /// wait until all queued tasks are completed void waitUntilEmpty(); - void waitUntilWorkersDone(); private: class ThreadWorker; friend class ThreadWorker; + /// wait until all work is completed, then join all threads + void waitAndCleanupWorkers(); + ThreadTask *waitForWork( osl::Condition &rNewWork ); ThreadTask *popWork(); |