Kaydet (Commit) 3902bb7a authored tarafından Miklos Vajna's avatar Miklos Vajna

Revert "comphelper: fix MSVC hang in ThreadPool::shutdown()"

As it causes "unopkg.bin:
/home/tdf/lode/jenkins/workspace/lo_gerrit/Config/linux_clang_dbgutil_64/comphelper/source/misc/threadpool.cxx:96:
comphelper::ThreadPool::~ThreadPool(): Assertion `mbTerminate' failed."
in
<https://ci.libreoffice.org/job/lo_gerrit/8283/Config=linux_clang_dbgutil_64/console>
and also locally. Revert till it's clear if that assert() should be a
SAL_WARN() or unopkg has to be fixed.

This reverts commit 9899ffd2.

Change-Id: I72902f7da410012340aa8231d84c6871a3f7b976
üst 9d778261
...@@ -89,12 +89,7 @@ ThreadPool::ThreadPool( sal_Int32 nWorkers ) : ...@@ -89,12 +89,7 @@ ThreadPool::ThreadPool( sal_Int32 nWorkers ) :
ThreadPool::~ThreadPool() ThreadPool::~ThreadPool()
{ {
// note: calling shutdown from global variable dtor blocks forever on Win7 shutdown();
// note2: there isn't enough MSVCRT left on exit to call assert() properly
// so these asserts just print something to stderr but exit status is
// still 0, but hopefully they will be more helpful on non-WNT platforms
assert(mbTerminate);
assert(maTasks.empty());
} }
struct ThreadPoolStatic : public rtl::StaticWithInit< std::shared_ptr< ThreadPool >, struct ThreadPoolStatic : public rtl::StaticWithInit< std::shared_ptr< ThreadPool >,
...@@ -132,7 +127,6 @@ sal_Int32 ThreadPool::getPreferredConcurrency() ...@@ -132,7 +127,6 @@ sal_Int32 ThreadPool::getPreferredConcurrency()
return ThreadCount; return ThreadCount;
} }
// FIXME: what does "this" refer to in the following?
// FIXME: there should be no need for this as/when our baseline // FIXME: there should be no need for this as/when our baseline
// is >VS2015 and drop WinXP; the sorry details are here: // is >VS2015 and drop WinXP; the sorry details are here:
// https://connect.microsoft.com/VisualStudio/feedback/details/1282596 // https://connect.microsoft.com/VisualStudio/feedback/details/1282596
......
...@@ -119,16 +119,8 @@ namespace ...@@ -119,16 +119,8 @@ namespace
uno::Reference<container::XNameAccess> xNA(xZip, uno::UNO_QUERY); uno::Reference<container::XNameAccess> xNA(xZip, uno::UNO_QUERY);
CPPUNIT_ASSERT(xNA.is()); CPPUNIT_ASSERT(xNA.is());
struct TestThreadPool
{ {
comphelper::ThreadPool aPool; comphelper::ThreadPool aPool(4);
TestThreadPool(sal_Int32 const i) : aPool(i) {}
~TestThreadPool() { aPool.shutdown(); }
};
{
TestThreadPool aPool(4);
comphelper::ThreadPool & rPool(aPool.aPool);
std::shared_ptr<comphelper::ThreadTaskTag> pTag = comphelper::ThreadPool::createThreadTaskTag(); std::shared_ptr<comphelper::ThreadTaskTag> pTag = comphelper::ThreadPool::createThreadTaskTag();
std::vector<std::vector<char>> aTestBuffers(26); std::vector<std::vector<char>> aTestBuffers(26);
...@@ -143,10 +135,10 @@ namespace ...@@ -143,10 +135,10 @@ namespace
xNA->getByName(aName) >>= xStrm; xNA->getByName(aName) >>= xStrm;
CPPUNIT_ASSERT(xStrm.is()); CPPUNIT_ASSERT(xStrm.is());
rPool.pushTask(new Worker(pTag, xStrm, *itBuf)); aPool.pushTask(new Worker(pTag, xStrm, *itBuf));
} }
rPool.waitUntilDone(pTag); aPool.waitUntilDone(pTag);
// Verify the streams. // Verify the streams.
CPPUNIT_ASSERT_EQUAL(size_t(26), aTestBuffers.size()); CPPUNIT_ASSERT_EQUAL(size_t(26), aTestBuffers.size());
......
...@@ -318,7 +318,7 @@ static PyObject* getComponentContext( ...@@ -318,7 +318,7 @@ static PyObject* getComponentContext(
} }
static PyObject* initTestEnvironment( static PyObject* initTestEnvironment(
SAL_UNUSED_PARAMETER PyObject*, SAL_UNUSED_PARAMETER PyObject* args) SAL_UNUSED_PARAMETER PyObject*, SAL_UNUSED_PARAMETER PyObject*)
{ {
// this tries to bootstrap enough of the soffice from python to run // this tries to bootstrap enough of the soffice from python to run
// unit tests, which is only possible indirectly because pyuno is URE // unit tests, which is only possible indirectly because pyuno is URE
...@@ -349,21 +349,10 @@ static PyObject* initTestEnvironment( ...@@ -349,21 +349,10 @@ static PyObject* initTestEnvironment(
mod.load(OStringToOUString(libname, osl_getThreadTextEncoding()), mod.load(OStringToOUString(libname, osl_getThreadTextEncoding()),
SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL); SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL);
if (!mod.is()) { abort(); } if (!mod.is()) { abort(); }
assert(PyTuple_Check(args)); oslGenericFunction const pFunc(
if (PyTuple_Size(args) == 0) mod.getFunctionSymbol("test_init"));
{ if (!pFunc) { abort(); }
oslGenericFunction const pFunc( reinterpret_cast<void (SAL_CALL *)(XMultiServiceFactory*)>(pFunc)(xMSF.get());
mod.getFunctionSymbol("test_init"));
if (!pFunc) { abort(); }
reinterpret_cast<void (SAL_CALL *)(XMultiServiceFactory*)>(pFunc)(xMSF.get());
}
else
{
oslGenericFunction const pFunc(
mod.getFunctionSymbol("test_fini"));
if (!pFunc) { abort(); }
reinterpret_cast<void (SAL_CALL *)()>(pFunc)();
}
} }
catch (const css::uno::Exception &) catch (const css::uno::Exception &)
{ {
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include <rtl/bootstrap.hxx> #include <rtl/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx> #include <cppuhelper/bootstrap.hxx>
#include <comphelper/processfactory.hxx> #include <comphelper/processfactory.hxx>
#include <comphelper/threadpool.hxx>
#include <com/sun/star/lang/Locale.hpp> #include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XComponent.hpp> #include <com/sun/star/lang/XComponent.hpp>
...@@ -98,12 +97,6 @@ SAL_DLLPUBLIC_EXPORT void test_init(lang::XMultiServiceFactory *pFactory) ...@@ -98,12 +97,6 @@ SAL_DLLPUBLIC_EXPORT void test_init(lang::XMultiServiceFactory *pFactory)
catch (...) { abort(); } catch (...) { abort(); }
} }
// this is called from pyuno
SAL_DLLPUBLIC_EXPORT void test_fini()
{
::comphelper::ThreadPool::getSharedOptimalPool().shutdown();
}
} // extern "C" } // extern "C"
void test::BootstrapFixture::setUp() void test::BootstrapFixture::setUp()
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include <sal/types.h> #include <sal/types.h>
#include <test/setupvcl.hxx> #include <test/setupvcl.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <comphelper/threadpool.hxx>
#include <isheadless.hxx> #include <isheadless.hxx>
...@@ -29,8 +28,6 @@ public: ...@@ -29,8 +28,6 @@ public:
private: private:
virtual ~Protector() override { virtual ~Protector() override {
DeInitVCL(); DeInitVCL();
// for the 6 tests that use it
comphelper::ThreadPool::getSharedOptimalPool().shutdown();
} }
virtual bool protect( virtual bool protect(
......
...@@ -182,9 +182,6 @@ class UnoInProcess: ...@@ -182,9 +182,6 @@ class UnoInProcess:
global havePonies global havePonies
if not(havePonies): if not(havePonies):
pyuno.private_initTestEnvironment() pyuno.private_initTestEnvironment()
# note: this will be called early enough, from Py_Finalize
import atexit
atexit.register(pyuno.private_initTestEnvironment, False)
havePonies = True havePonies = True
def openEmptyWriterDoc(self): def openEmptyWriterDoc(self):
assert(self.xContext) assert(self.xContext)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment