summaryrefslogtreecommitdiff
path: root/linguistic
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@collabora.com>2024-02-06 18:05:09 +0000
committerMichael Meeks <michael.meeks@collabora.com>2024-02-14 17:29:02 +0100
commit52f2720af102c9a4800db085bbe09e60e5d6a3c7 (patch)
tree66067521e252863cdf63bca3a4637725d6143736 /linguistic
parentd87206370b840adef6dfd03ed280a1de5635fac6 (diff)
lok: implement a joinThreads function - to wind down thread pools.
Necessary to do this before forking on Unix systems; use a dynamic_cast interface since this is all for internal use. Change-Id: I8a911322acd4ec5654eb0d14804c09d513a0bd4b Signed-off-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163335 Tested-by: Jenkins
Diffstat (limited to 'linguistic')
-rw-r--r--linguistic/source/gciterator.cxx8
-rw-r--r--linguistic/source/gciterator.hxx7
-rw-r--r--linguistic/source/lngsvcmgr.cxx8
-rw-r--r--linguistic/source/lngsvcmgr.hxx7
4 files changed, 28 insertions, 2 deletions
diff --git a/linguistic/source/gciterator.cxx b/linguistic/source/gciterator.cxx
index b35882785995..ad85bab95953 100644
--- a/linguistic/source/gciterator.cxx
+++ b/linguistic/source/gciterator.cxx
@@ -312,6 +312,14 @@ void GrammarCheckingIterator::TerminateThread()
}
}
+
+bool GrammarCheckingIterator::joinThreads()
+{
+ TerminateThread();
+ return true;
+}
+
+
sal_Int32 GrammarCheckingIterator::NextDocId()
{
::osl::Guard< ::osl::Mutex > aGuard( MyMutex() );
diff --git a/linguistic/source/gciterator.hxx b/linguistic/source/gciterator.hxx
index e25b15a96226..62b3a53af8fa 100644
--- a/linguistic/source/gciterator.hxx
+++ b/linguistic/source/gciterator.hxx
@@ -34,6 +34,7 @@
#include <osl/thread.h>
#include <com/sun/star/uno/Any.hxx>
+#include <comphelper/lok.hxx>
#include <comphelper/interfacecontainer3.hxx>
#include <i18nlangtag/lang.h>
@@ -80,7 +81,8 @@ class GrammarCheckingIterator:
css::lang::XComponent,
css::lang::XServiceInfo
>,
- public LinguDispatcher
+ public LinguDispatcher,
+ public comphelper::LibreOfficeKit::ThreadJoinable
{
//the queue is keeping track of all sentences to be checked
//every element of this queue is a FlatParagraphEntry struct-object
@@ -185,6 +187,9 @@ public:
// LinguDispatcher
virtual void SetServiceList( const css::lang::Locale &rLocale, const css::uno::Sequence< OUString > &rSvcImplNames ) override;
virtual css::uno::Sequence< OUString > GetServiceList( const css::lang::Locale &rLocale ) const override;
+
+ // comphelper::LibreOfficeKit::ThreadJoinable
+ virtual bool joinThreads() override;
};
diff --git a/linguistic/source/lngsvcmgr.cxx b/linguistic/source/lngsvcmgr.cxx
index 9452d0649a37..8ab2efd46ad9 100644
--- a/linguistic/source/lngsvcmgr.cxx
+++ b/linguistic/source/lngsvcmgr.cxx
@@ -452,6 +452,14 @@ void LngSvcMgr::modified(const lang::EventObject&)
aUpdateIdle.Start();
}
+bool LngSvcMgr::joinThreads()
+{
+ if (mxGrammarDsp && !
+ mxGrammarDsp->joinThreads())
+ return false;
+ return true;
+}
+
//run update, and inform everyone that dictionaries (may) have changed, this
//needs to be run in the main thread because
//utl::ConfigChangeListener_Impl::changesOccurred grabs the SolarMutex and we
diff --git a/linguistic/source/lngsvcmgr.hxx b/linguistic/source/lngsvcmgr.hxx
index f21dc70a1b8c..fcec04f37237 100644
--- a/linguistic/source/lngsvcmgr.hxx
+++ b/linguistic/source/lngsvcmgr.hxx
@@ -22,6 +22,7 @@
#include <cppuhelper/implbase.hxx>
#include <comphelper/interfacecontainer3.hxx>
+#include <comphelper/lok.hxx>
#include <com/sun/star/uno/Reference.h>
#include <com/sun/star/lang/XServiceInfo.hpp>
@@ -58,7 +59,8 @@ class LngSvcMgr :
css::lang::XServiceInfo,
css::util::XModifyListener
>,
- private utl::ConfigItem
+ private utl::ConfigItem,
+ public comphelper::LibreOfficeKit::ThreadJoinable
{
friend class LngSvcMgrListenerHelper;
@@ -156,6 +158,9 @@ public:
// XModifyListener
virtual void SAL_CALL modified( const css::lang::EventObject& rEvent ) override;
+ // comphelper::LibreOfficeKit::ThreadJoinable
+ virtual bool joinThreads() override;
+
bool AddLngSvcEvtBroadcaster(
const css::uno::Reference< css::linguistic2::XLinguServiceEventBroadcaster > &rxBroadcaster );
};