diff options
author | Dennis Francis <dennis.francis@collabora.com> | 2019-03-20 20:07:58 +0530 |
---|---|---|
committer | Michael Meeks <michael.meeks@collabora.com> | 2019-03-21 11:24:26 +0100 |
commit | 769832cc1f592b1d0c39cda7795fe4548fc97566 (patch) | |
tree | 404546dfca76bc766ad88fcf9fe8f3cb5f7ad3f1 /include/comphelper/threadpool.hxx | |
parent | 3d9f973e6648c5819608237f390df523b6a32ed8 (diff) |
Increase the life-cycle of threads in thread-pool...
to ScDocument lifetime if possible. This helps to avoid lots
of thread setup-cost while doing recalcs especially if there are
many formula-groups in the document and most of them are fairly
light-weight.
Change-Id: Idd57e1ebd0d4e492f99e31237d4a55ec9c95a121
Reviewed-on: https://gerrit.libreoffice.org/69473
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'include/comphelper/threadpool.hxx')
-rw-r--r-- | include/comphelper/threadpool.hxx | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/include/comphelper/threadpool.hxx b/include/comphelper/threadpool.hxx index 092078199981..1cb9441cfdd1 100644 --- a/include/comphelper/threadpool.hxx +++ b/include/comphelper/threadpool.hxx @@ -63,8 +63,13 @@ public: /// push a new task onto the work queue void pushTask( std::unique_ptr<ThreadTask> pTask); - /// wait until all queued tasks associated with the tag are completed - void waitUntilDone(const std::shared_ptr<ThreadTaskTag>&); + /** Wait until all queued tasks associated with the tag are completed + @param bJoinAll - if set it joins all threads at the end if no other tasks from other tags. + */ + void waitUntilDone(const std::shared_ptr<ThreadTaskTag>&, bool bJoinAll = true); + + /// join all threads if there are no tasks presently. + void joinAll(); /// return the number of live worker threads sal_Int32 getWorkerCount() const { return mnWorkers; } |