summaryrefslogtreecommitdiff
path: root/package
diff options
context:
space:
mode:
Diffstat (limited to 'package')
-rw-r--r--package/inc/ZipOutputStream.hxx4
-rw-r--r--package/source/zipapi/ZipOutputStream.cxx6
-rw-r--r--package/source/zippackage/ZipPackageStream.cxx7
3 files changed, 10 insertions, 7 deletions
diff --git a/package/inc/ZipOutputStream.hxx b/package/inc/ZipOutputStream.hxx
index 136bc72b249d..1fc41661d186 100644
--- a/package/inc/ZipOutputStream.hxx
+++ b/package/inc/ZipOutputStream.hxx
@@ -35,10 +35,10 @@ class ZipOutputStream
{
css::uno::Reference< css::io::XOutputStream > m_xStream;
::std::vector < ZipEntry * > m_aZipList;
+ std::shared_ptr<comphelper::ThreadTaskTag> mpThreadTaskTag;
ByteChucker m_aChucker;
ZipEntry *m_pCurrentEntry;
- comphelper::ThreadPool &m_rSharedThreadPool;
std::vector< ZipOutputEntry* > m_aEntries;
::css::uno::Any m_aDeflateException;
@@ -80,6 +80,8 @@ public:
void reduceScheduledThreadsToGivenNumberOrLess(
sal_Int32 nThreads,
sal_Int32 nWaitTimeInTenthSeconds);
+
+ const std::shared_ptr<comphelper::ThreadTaskTag>& getThreadTaskTag() { return mpThreadTaskTag; }
};
#endif
diff --git a/package/source/zipapi/ZipOutputStream.cxx b/package/source/zipapi/ZipOutputStream.cxx
index 41f78b414879..7e9ffe5bfc1a 100644
--- a/package/source/zipapi/ZipOutputStream.cxx
+++ b/package/source/zipapi/ZipOutputStream.cxx
@@ -42,9 +42,9 @@ using namespace com::sun::star::packages::zip::ZipConstants;
*/
ZipOutputStream::ZipOutputStream( const uno::Reference < io::XOutputStream > &xOStream )
: m_xStream(xOStream)
+, mpThreadTaskTag( comphelper::ThreadPool::createThreadTaskTag() )
, m_aChucker(xOStream)
, m_pCurrentEntry(nullptr)
-, m_rSharedThreadPool(comphelper::ThreadPool::getSharedOptimalPool())
{
}
@@ -70,7 +70,7 @@ void ZipOutputStream::setEntry( ZipEntry *pEntry )
void ZipOutputStream::addDeflatingThread( ZipOutputEntry *pEntry, comphelper::ThreadTask *pThread )
{
- m_rSharedThreadPool.pushTask(pThread);
+ comphelper::ThreadPool::getSharedOptimalPool().pushTask(pThread);
m_aEntries.push_back(pEntry);
}
@@ -178,7 +178,7 @@ void ZipOutputStream::finish()
assert(!m_aZipList.empty() && "Zip file must have at least one entry!");
// Wait for all threads to finish & write
- m_rSharedThreadPool.waitUntilEmpty();
+ comphelper::ThreadPool::getSharedOptimalPool().waitUntilDone(mpThreadTaskTag);
// consume all processed entries
consumeAllScheduledThreadEntries();
diff --git a/package/source/zippackage/ZipPackageStream.cxx b/package/source/zippackage/ZipPackageStream.cxx
index 5efb145fd9f7..e72c3999c9f5 100644
--- a/package/source/zippackage/ZipPackageStream.cxx
+++ b/package/source/zippackage/ZipPackageStream.cxx
@@ -466,9 +466,10 @@ class DeflateThread: public comphelper::ThreadTask
uno::Reference< io::XInputStream > mxInStream;
public:
- DeflateThread( ZipOutputEntry *pEntry,
+ DeflateThread( const std::shared_ptr<comphelper::ThreadTaskTag>& pTag, ZipOutputEntry *pEntry,
const uno::Reference< io::XInputStream >& xInStream )
- : mpEntry(pEntry)
+ : comphelper::ThreadTask(pTag)
+ , mpEntry(pEntry)
, mxInStream(xInStream)
{}
@@ -849,7 +850,7 @@ bool ZipPackageStream::saveChild(
// Start a new thread deflating this zip entry
ZipOutputEntry *pZipEntry = new ZipOutputEntry(
m_xContext, *pTempEntry, this, bToBeEncrypted);
- rZipOut.addDeflatingThread( pZipEntry, new DeflateThread(pZipEntry, xStream) );
+ rZipOut.addDeflatingThread( pZipEntry, new DeflateThread(rZipOut.getThreadTaskTag(), pZipEntry, xStream) );
}
else
{