summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2017-03-13 09:17:21 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2017-03-13 12:11:04 +0100
commit3902bb7a45f6266c51e01eddcda4e25b34814957 (patch)
treee011f64cdfcc37975efd5497155f138813caad34
parent9d778261d4dd6e50e6c5f7583c4dfa5f8d5b5a0b (diff)
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 9899ffd244dd367ba69dffe1f21f4f0222064a46. Change-Id: I72902f7da410012340aa8231d84c6871a3f7b976
-rw-r--r--comphelper/source/misc/threadpool.cxx8
-rw-r--r--package/qa/cppunit/test_package.cxx14
-rw-r--r--pyuno/source/module/pyuno_module.cxx21
-rw-r--r--test/source/bootstrapfixture.cxx7
-rw-r--r--test/source/vclbootstrapprotector.cxx3
-rw-r--r--unotest/source/python/org/libreoffice/unotest.py3
6 files changed, 9 insertions, 47 deletions
diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx
index 1219ef24b986..712009d8a2b4 100644
--- a/comphelper/source/misc/threadpool.cxx
+++ b/comphelper/source/misc/threadpool.cxx
@@ -89,12 +89,7 @@ ThreadPool::ThreadPool( sal_Int32 nWorkers ) :
ThreadPool::~ThreadPool()
{
- // note: calling shutdown from global variable dtor blocks forever on Win7
- // 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());
+ shutdown();
}
struct ThreadPoolStatic : public rtl::StaticWithInit< std::shared_ptr< ThreadPool >,
@@ -132,7 +127,6 @@ sal_Int32 ThreadPool::getPreferredConcurrency()
return ThreadCount;
}
-// FIXME: what does "this" refer to in the following?
// 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
diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx
index d015e8db8d66..335f490ddaba 100644
--- a/package/qa/cppunit/test_package.cxx
+++ b/package/qa/cppunit/test_package.cxx
@@ -119,16 +119,8 @@ namespace
uno::Reference<container::XNameAccess> xNA(xZip, uno::UNO_QUERY);
CPPUNIT_ASSERT(xNA.is());
- struct TestThreadPool
{
- comphelper::ThreadPool aPool;
- TestThreadPool(sal_Int32 const i) : aPool(i) {}
- ~TestThreadPool() { aPool.shutdown(); }
- };
-
- {
- TestThreadPool aPool(4);
- comphelper::ThreadPool & rPool(aPool.aPool);
+ comphelper::ThreadPool aPool(4);
std::shared_ptr<comphelper::ThreadTaskTag> pTag = comphelper::ThreadPool::createThreadTaskTag();
std::vector<std::vector<char>> aTestBuffers(26);
@@ -143,10 +135,10 @@ namespace
xNA->getByName(aName) >>= xStrm;
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.
CPPUNIT_ASSERT_EQUAL(size_t(26), aTestBuffers.size());
diff --git a/pyuno/source/module/pyuno_module.cxx b/pyuno/source/module/pyuno_module.cxx
index 93a58111f6ae..40ed69e0191b 100644
--- a/pyuno/source/module/pyuno_module.cxx
+++ b/pyuno/source/module/pyuno_module.cxx
@@ -318,7 +318,7 @@ static PyObject* getComponentContext(
}
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
// unit tests, which is only possible indirectly because pyuno is URE
@@ -349,21 +349,10 @@ static PyObject* initTestEnvironment(
mod.load(OStringToOUString(libname, osl_getThreadTextEncoding()),
SAL_LOADMODULE_LAZY | SAL_LOADMODULE_GLOBAL);
if (!mod.is()) { abort(); }
- assert(PyTuple_Check(args));
- if (PyTuple_Size(args) == 0)
- {
- oslGenericFunction const pFunc(
- 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)();
- }
+ oslGenericFunction const pFunc(
+ mod.getFunctionSymbol("test_init"));
+ if (!pFunc) { abort(); }
+ reinterpret_cast<void (SAL_CALL *)(XMultiServiceFactory*)>(pFunc)(xMSF.get());
}
catch (const css::uno::Exception &)
{
diff --git a/test/source/bootstrapfixture.cxx b/test/source/bootstrapfixture.cxx
index 5fa01a388c50..c97c0ceed535 100644
--- a/test/source/bootstrapfixture.cxx
+++ b/test/source/bootstrapfixture.cxx
@@ -16,7 +16,6 @@
#include <rtl/bootstrap.hxx>
#include <cppuhelper/bootstrap.hxx>
#include <comphelper/processfactory.hxx>
-#include <comphelper/threadpool.hxx>
#include <com/sun/star/lang/Locale.hpp>
#include <com/sun/star/lang/XComponent.hpp>
@@ -98,12 +97,6 @@ SAL_DLLPUBLIC_EXPORT void test_init(lang::XMultiServiceFactory *pFactory)
catch (...) { abort(); }
}
-// this is called from pyuno
-SAL_DLLPUBLIC_EXPORT void test_fini()
-{
- ::comphelper::ThreadPool::getSharedOptimalPool().shutdown();
-}
-
} // extern "C"
void test::BootstrapFixture::setUp()
diff --git a/test/source/vclbootstrapprotector.cxx b/test/source/vclbootstrapprotector.cxx
index 2218c8fff2c0..38c51d990922 100644
--- a/test/source/vclbootstrapprotector.cxx
+++ b/test/source/vclbootstrapprotector.cxx
@@ -14,7 +14,6 @@
#include <sal/types.h>
#include <test/setupvcl.hxx>
#include <vcl/svapp.hxx>
-#include <comphelper/threadpool.hxx>
#include <isheadless.hxx>
@@ -29,8 +28,6 @@ public:
private:
virtual ~Protector() override {
DeInitVCL();
- // for the 6 tests that use it
- comphelper::ThreadPool::getSharedOptimalPool().shutdown();
}
virtual bool protect(
diff --git a/unotest/source/python/org/libreoffice/unotest.py b/unotest/source/python/org/libreoffice/unotest.py
index 38c6b2266b31..13b00845bb36 100644
--- a/unotest/source/python/org/libreoffice/unotest.py
+++ b/unotest/source/python/org/libreoffice/unotest.py
@@ -182,9 +182,6 @@ class UnoInProcess:
global havePonies
if not(havePonies):
pyuno.private_initTestEnvironment()
- # note: this will be called early enough, from Py_Finalize
- import atexit
- atexit.register(pyuno.private_initTestEnvironment, False)
havePonies = True
def openEmptyWriterDoc(self):
assert(self.xContext)