Allow the comphelper threadpool to be reset after construction.

Otherwise some pre-init components can start it, and threads get
stranded in the forkit process causing grief.

Change-Id: Ib1846f8b329b4c6b84645999dafba1252c5129c7
Reviewed-on: https://gerrit.libreoffice.org/57631
Tested-by: Jenkins
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
This commit is contained in:
Michael Meeks
2018-07-18 22:28:51 +02:00
parent 98fdac1e1f
commit 5bfdbc6640
2 changed files with 8 additions and 5 deletions
+4 -5
View File
@@ -128,13 +128,12 @@ sal_Int32 ThreadPool::getPreferredConcurrency()
return ThreadCount;
}
// FIXME: there should be no need for this as/when our baseline
// is >VS2015 and drop WinXP; the sorry details are here:
// https://connect.microsoft.com/VisualStudio/feedback/details/1282596
// Used to order shutdown, and to ensure there are no lingering
// threads after LibreOfficeKit pre-init.
void ThreadPool::shutdown()
{
if (mbTerminate)
return;
// if (mbTerminate)
// return;
std::unique_lock< std::mutex > aGuard( maMutex );
shutdownLocked(aGuard);
+4
View File
@@ -36,6 +36,7 @@
#include <comphelper/string.hxx>
#include <comphelper/propertysequence.hxx>
#include <comphelper/scopeguard.hxx>
#include <comphelper/threadpool.hxx>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/container/XNameAccess.hpp>
@@ -3968,7 +3969,10 @@ static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char
}
if (eStage == PRE_INIT)
{
comphelper::ThreadPool::getSharedOptimalPool().shutdown();
rtl_alloc_preInit(rtlAllocPostInit);
}
return bInitialized;
}