diff options
Diffstat (limited to 'package/qa/cppunit/test_package.cxx')
-rw-r--r-- | package/qa/cppunit/test_package.cxx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/package/qa/cppunit/test_package.cxx b/package/qa/cppunit/test_package.cxx index 335f490ddaba..d015e8db8d66 100644 --- a/package/qa/cppunit/test_package.cxx +++ b/package/qa/cppunit/test_package.cxx @@ -119,8 +119,16 @@ namespace uno::Reference<container::XNameAccess> xNA(xZip, uno::UNO_QUERY); CPPUNIT_ASSERT(xNA.is()); + struct TestThreadPool { - comphelper::ThreadPool aPool(4); + comphelper::ThreadPool aPool; + 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::vector<std::vector<char>> aTestBuffers(26); @@ -135,10 +143,10 @@ namespace xNA->getByName(aName) >>= xStrm; CPPUNIT_ASSERT(xStrm.is()); - aPool.pushTask(new Worker(pTag, xStrm, *itBuf)); + rPool.pushTask(new Worker(pTag, xStrm, *itBuf)); } - aPool.waitUntilDone(pTag); + rPool.waitUntilDone(pTag); // Verify the streams. CPPUNIT_ASSERT_EQUAL(size_t(26), aTestBuffers.size()); |