summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorStephan Bergmann <stephan.bergmann@allotropia.de>2024-07-25 10:51:16 +0200
committerStephan Bergmann <stephan.bergmann@allotropia.de>2024-07-25 13:27:53 +0200
commitb84ef4d67eaf9f9fd7fd700ca05339cb0cdff742 (patch)
tree959f86dfb4b5a936f3431125adea54af523de349 /include
parent4b6390290fcfdea882fde93facef00ac33dd8b88 (diff)
Adapt comphelper::ThreadPool to Emscripten's threading needs
...by keeping the worker threads around by default instead of joining and later re-spawning them; see 5b1df7709d75c6dd993da5a272e7e37e55a70174 "Document the Emscripten threads issue". But lets be cautious and change the bJoin default only for Emscripten. Also, cap the thread pool size to MAX_CONCURRENCY=4 and increase to -sPTHREAD_POOL_SIZE=6. In an experimental setup where the Emscripten build starts up with the start center rather than a Writer document, that is just enough to cover the thread-spawning needs when executing the start center window's paint task: Four threads for the comphelper::ThreadPool (used from within drawinglayer::convertToBitmapEx -> ... -> BitmapBasicMorphologyFilter::filter), and one each for configmgr::Components::WriteThread (see e8358d0a0f7c2c4b1ccf800fe9ec8a7f2bf7066a "Keep around a single configmgr::Components::WriteThread instance") and salhelper::TimerManager. Change-Id: I5b1d0e9dc09f05fb3b679c8dc1c38ee45c61c0f8 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171004 Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de> Tested-by: Jenkins
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/threadpool.hxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/comphelper/threadpool.hxx b/include/comphelper/threadpool.hxx
index 84f9dc9284f6..0b2ebc8ac9e6 100644
--- a/include/comphelper/threadpool.hxx
+++ b/include/comphelper/threadpool.hxx
@@ -67,7 +67,13 @@ public:
/** Wait until all queued tasks associated with the tag are completed
@param bJoin - if set call joinThreadsIfIdle() at the end
*/
- void waitUntilDone(const std::shared_ptr<ThreadTaskTag>&, bool bJoin = true);
+ void waitUntilDone(const std::shared_ptr<ThreadTaskTag>&, bool bJoin =
+#if defined EMSCRIPTEN
+ false
+#else
+ true
+#endif
+ );
/// join all threads if there are no tasks presently.
void joinThreadsIfIdle();