diff options
author | Noel Grandin <noel@peralex.com> | 2016-07-08 14:29:53 +0200 |
---|---|---|
committer | Noel Grandin <noelgrandin@gmail.com> | 2016-07-18 06:49:09 +0000 |
commit | 76ad32bec8e2c00c21247041b16d9e09e73d2504 (patch) | |
tree | 7b2b1277151bc7904ff63684ebd7e3d6d8a7d661 /drawinglayer/source | |
parent | 9bf9f88e4c7e0b182ec6d8b4aefb7d735bb0653b (diff) |
add tagging to ThreadTasks so we don't need more one pool
If more than one place in the code submits tasks to the shared
pool, then waitTillDone() becomes unreliable.
Add a tagging mechanism, so different callsites can wait
on different sets of tasks.
Also try to protect our worker threads against exceptions from
the thread tasks code.
Change-Id: Idde664ab50008d31a2dd73910bb22f50e62ae22f
Reviewed-on: https://gerrit.libreoffice.org/27042
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'drawinglayer/source')
-rw-r--r-- | drawinglayer/source/primitive2d/sceneprimitive2d.cxx | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx index 68acb57ff5d6..b87df2739280 100644 --- a/drawinglayer/source/primitive2d/sceneprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/sceneprimitive2d.cxx @@ -400,9 +400,11 @@ namespace drawinglayer public: explicit Executor( + std::shared_ptr<comphelper::ThreadTaskTag>& rTag, processor3d::ZBufferProcessor3D* pZBufferProcessor3D, const primitive3d::Primitive3DContainer& rChildren3D) - : mpZBufferProcessor3D(pZBufferProcessor3D), + : comphelper::ThreadTask(rTag), + mpZBufferProcessor3D(pZBufferProcessor3D), mrChildren3D(rChildren3D) { } @@ -417,6 +419,7 @@ namespace drawinglayer std::vector< processor3d::ZBufferProcessor3D* > aProcessors; const sal_uInt32 nLinesPerThread(aBZPixelRaster.getHeight() / nThreadCount); + std::shared_ptr<comphelper::ThreadTaskTag> aTag = comphelper::ThreadPool::createThreadTaskTag(); for(sal_Int32 a(0); a < nThreadCount; a++) { @@ -432,11 +435,11 @@ namespace drawinglayer nLinesPerThread * a, a + 1 == nThreadCount ? aBZPixelRaster.getHeight() : nLinesPerThread * (a + 1)); aProcessors.push_back(pNewZBufferProcessor3D); - Executor* pExecutor = new Executor(pNewZBufferProcessor3D, getChildren3D()); + Executor* pExecutor = new Executor(aTag, pNewZBufferProcessor3D, getChildren3D()); rThreadPool.pushTask(pExecutor); } - rThreadPool.waitUntilEmpty(); + rThreadPool.waitUntilDone(aTag); } else { |