summaryrefslogtreecommitdiff
path: root/include
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 /include
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 'include')
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.h3
-rw-r--r--include/LibreOfficeKit/LibreOfficeKit.hxx12
-rw-r--r--include/comphelper/lok.hxx8
3 files changed, 22 insertions, 1 deletions
diff --git a/include/LibreOfficeKit/LibreOfficeKit.h b/include/LibreOfficeKit/LibreOfficeKit.h
index 963d7962a6c2..78651128d3ac 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.h
+++ b/include/LibreOfficeKit/LibreOfficeKit.h
@@ -140,6 +140,9 @@ struct _LibreOfficeKitClass
/// @see lok::Office::stopURP
void (*stopURP)(LibreOfficeKit* pThis, void* pSendURPToLOContext);
+
+ /// @see lok::Office::joinThreads
+ int (*joinThreads)(LibreOfficeKit* pThis);
};
#define LIBREOFFICEKIT_DOCUMENT_HAS(pDoc,member) LIBREOFFICEKIT_HAS_MEMBER(LibreOfficeKitDocumentClass,member,(pDoc)->pClass->nSize)
diff --git a/include/LibreOfficeKit/LibreOfficeKit.hxx b/include/LibreOfficeKit/LibreOfficeKit.hxx
index 29e644900caf..e94053378355 100644
--- a/include/LibreOfficeKit/LibreOfficeKit.hxx
+++ b/include/LibreOfficeKit/LibreOfficeKit.hxx
@@ -1051,7 +1051,6 @@ public:
* @since LibreOffice 6.0
* @param pURL macro url to run
*/
-
bool runMacro( const char* pURL)
{
return mpThis->pClass->runMacro( mpThis, pURL );
@@ -1197,6 +1196,17 @@ public:
{
mpThis->pClass->stopURP(mpThis, pURPContext);
}
+
+ /**
+ * Joins all threads if possible to get down to a single process
+ * which can be forked from safely.
+ *
+ * @returns non-zero for successful join, 0 for failure.
+ */
+ int joinThreads()
+ {
+ return mpThis->pClass->joinThreads(mpThis);
+ }
};
/// Factory method to create a lok::Office instance.
diff --git a/include/comphelper/lok.hxx b/include/comphelper/lok.hxx
index 545136f762ea..4ca03f049225 100644
--- a/include/comphelper/lok.hxx
+++ b/include/comphelper/lok.hxx
@@ -20,6 +20,14 @@ class LanguageTag;
namespace comphelper::LibreOfficeKit
{
+/// interface for allowing threads to be transiently shutdown.
+class COMPHELPER_DLLPUBLIC SAL_LOPLUGIN_ANNOTATE("crosscast") ThreadJoinable
+{
+public:
+ /// shutdown and join threads, @returns true on success
+ virtual bool joinThreads() = 0;
+};
+
// Functions to be called only from the LibreOfficeKit implementation in desktop, not from other
// places in LibreOffice code.