[med-svn] [opensurgsim] 03/04: Disable Thread Pool on armel
Paul Novotny
paulnovo-guest at moszumanska.debian.org
Tue Oct 25 22:00:56 UTC 2016
This is an automated email from the git hooks/post-receive script.
paulnovo-guest pushed a commit to branch master
in repository opensurgsim.
commit 7f1faa7493dfd7e3d46e7b017b02e5c85bde2063
Author: Paul Novotny <paul at paulnovo.us>
Date: Mon Oct 24 17:46:38 2016 -0400
Disable Thread Pool on armel
---
debian/patches/disable-thread-pool-on-armel.patch | 474 ++++++++++++++++++++++
debian/patches/series | 1 +
2 files changed, 475 insertions(+)
diff --git a/debian/patches/disable-thread-pool-on-armel.patch b/debian/patches/disable-thread-pool-on-armel.patch
new file mode 100644
index 0000000..5489443
--- /dev/null
+++ b/debian/patches/disable-thread-pool-on-armel.patch
@@ -0,0 +1,474 @@
+Description: Disable Thread Pool on armel
+ std::future is not supported on armel due to missing atomics. This is
+ described here: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64735
+ This patch disables use of the ThreadPool, the only current use of
+ std::future in OpenSurgSim, on architectures that don't support
+ std::future.
+Author: Paul Novotny <paul at paulnovo.us>
+Last-Update: 2016-10-24
+
+--- a/SurgSim/Collision/UnitTests/RepresentationTest.cpp
++++ b/SurgSim/Collision/UnitTests/RepresentationTest.cpp
+@@ -24,7 +24,10 @@
+ #include "SurgSim/Framework/FrameworkConvert.h"
+ #include "SurgSim/Framework/Runtime.h"
+ #include "SurgSim/Framework/Scene.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Math/PlaneShape.h"
+ #include "SurgSim/Math/Quaternion.h"
+ #include "SurgSim/Math/RigidTransform.h"
+@@ -173,6 +176,8 @@
+ // addContact method thread-safety test case.
+ // WARNING: Due to the nature of multi-threaded environment, a successful test does not imply thread-safety
+ // also note the lack of reproducibility.
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ TEST_F(RepresentationTest, AddContactsInParallelTest)
+ {
+ auto rep = std::make_shared<ShapeCollisionRepresentation>("collisionRepReference");
+@@ -199,6 +204,7 @@
+ ASSERT_EQ(numContacts, rep->getCollisions().unsafeGet()[rep].size());
+ rep->retire();
+ }
++#endif
+
+ TEST_F(RepresentationTest, Ignoring)
+ {
+--- a/SurgSim/Framework/UnitTests/ThreadPoolTest.cpp
++++ b/SurgSim/Framework/UnitTests/ThreadPoolTest.cpp
+@@ -18,6 +18,9 @@
+
+ #include <gtest/gtest.h>
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
++
+ namespace
+ {
+
+@@ -77,3 +80,5 @@
+
+ };
+ };
++
++#endif
+--- a/SurgSim/Physics/CcdCollision.cpp
++++ b/SurgSim/Physics/CcdCollision.cpp
+@@ -20,7 +20,10 @@
+ #include "SurgSim/Collision/CcdDcdCollision.h"
+ #include "SurgSim/Collision/Representation.h"
+ #include "SurgSim/Framework/Runtime.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Physics/CcdCollision.h"
+ #include "SurgSim/Physics/PhysicsManagerState.h"
+
+@@ -46,8 +49,11 @@
+ const std::shared_ptr<PhysicsManagerState>& state)
+ {
+ std::shared_ptr<PhysicsManagerState> result = state;
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ auto threadPool = Framework::Runtime::getThreadPool();
+ std::vector<std::future<void>> tasks;
++#endif
+
+ const auto& calculations = ContactCalculation::getCcdContactTable();
+
+@@ -55,15 +61,24 @@
+ {
+ if (pair->getType() == Collision::COLLISION_DETECTION_TYPE_CONTINUOUS)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([&]()
+ {
+- calculations[pair->getFirst()->getShapeType()]
+- [pair->getSecond()->getShapeType()]->calculateContact(pair);
++ #endif
++ calculations[pair->getFirst()->getShapeType()][pair->getSecond()->getShapeType()]->
++ calculateContact(pair);
++ #if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ }));
++#endif
+ }
+ }
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ std::for_each(tasks.begin(), tasks.end(), [](std::future<void>& p){p.get();});
++#endif
+
+ return result;
+ }
+--- a/SurgSim/Physics/ContactFiltering.cpp
++++ b/SurgSim/Physics/ContactFiltering.cpp
+@@ -17,7 +17,10 @@
+
+ #include "SurgSim/Collision/ContactFilter.h"
+ #include "SurgSim/Framework/Runtime.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Physics/ContactFiltering.h"
+ #include "SurgSim/Physics/PhysicsManagerState.h"
+
+@@ -50,8 +53,11 @@
+ };
+
+ std::shared_ptr<PhysicsManagerState> result = state;
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ auto threadPool = Framework::Runtime::getThreadPool();
+ std::vector<std::future<void>> tasks;
++#endif
+
+ const auto& stateFilters = state->getContactFilters();
+ std::vector<std::shared_ptr<Collision::ContactFilter>> filters;
+@@ -75,20 +81,29 @@
+
+ for (auto& pair : pairs)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([&state, &filters, &pair]()
+ {
++#endif
+ for (const auto& filter : filters)
+ {
+ filter->filterContacts(state, pair);
+ }
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ }));
++#endif
+ }
+
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ std::for_each(tasks.begin(), tasks.end(), [](std::future<void>& p)
+ {
+ p.get();
+ });
++#endif
+
+ return result;
+ }
+--- a/SurgSim/Physics/DcdCollision.cpp
++++ b/SurgSim/Physics/DcdCollision.cpp
+@@ -20,7 +20,10 @@
+ #include "SurgSim/Collision/CcdDcdCollision.h"
+ #include "SurgSim/Collision/Representation.h"
+ #include "SurgSim/Framework/Runtime.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Physics/DcdCollision.h"
+ #include "SurgSim/Physics/PhysicsManagerState.h"
+
+@@ -46,8 +49,11 @@
+ const std::shared_ptr<PhysicsManagerState>& state)
+ {
+ std::shared_ptr<PhysicsManagerState> result = state;
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ auto threadPool = Framework::Runtime::getThreadPool();
+ std::vector<std::future<void>> tasks;
++#endif
+
+ const auto& calculations = ContactCalculation::getDcdContactTable();
+
+@@ -55,15 +61,24 @@
+ {
+ if (pair->getType() == Collision::COLLISION_DETECTION_TYPE_DISCRETE)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([&calculations, &pair]()
+ {
++#endif
+ calculations[pair->getFirst()->getShapeType()]
+ [pair->getSecond()->getShapeType()]->calculateContact(pair);
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ }));
++#endif
+ }
+ }
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ std::for_each(tasks.begin(), tasks.end(), [](std::future<void>& p){p.get();});
++#endif
+
+ return result;
+ }
+--- a/SurgSim/Physics/FreeMotion.cpp
++++ b/SurgSim/Physics/FreeMotion.cpp
+@@ -18,7 +18,10 @@
+ #include <vector>
+
+ #include "SurgSim/Framework/Runtime.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Physics/FreeMotion.h"
+ #include "SurgSim/Physics/PhysicsManagerState.h"
+ #include "SurgSim/Physics/Representation.h"
+@@ -46,25 +49,41 @@
+ // Copy state to new state
+ std::shared_ptr<PhysicsManagerState> result = state;
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ auto threadPool = Framework::Runtime::getThreadPool();
+ std::vector<std::future<void>> tasks;
++#endif
+
+ auto& representations = result->getActiveRepresentations();
+ for (auto& representation : representations)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([dt, &representation]() { representation->update(dt); }));
++#else
++ representation->update(dt);
++#endif
+ }
+
+ auto& particleRepresentations = result->getActiveParticleRepresentations();
+ for (auto& representation : particleRepresentations)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([dt, &representation]() { representation->update(dt); }));
++#else
++ representation->update(dt);
++#endif
+ }
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ for (auto& task : tasks)
+ {
+ task.get();
+ }
++#endif
+
+ return result;
+ }
+--- a/SurgSim/Physics/UpdateCcdData.cpp
++++ b/SurgSim/Physics/UpdateCcdData.cpp
+@@ -16,7 +16,10 @@
+ #include "SurgSim/Physics/UpdateCcdData.h"
+
+ #include "SurgSim/Framework/Runtime.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Physics/PhysicsManagerState.h"
+ #include "SurgSim/Collision/Representation.h"
+
+@@ -46,8 +49,11 @@
+ {
+ std::shared_ptr<PhysicsManagerState> result = state;
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ auto threadPool = Framework::Runtime::getThreadPool();
+ std::vector<std::future<void>> tasks;
++#endif
+
+ const auto& pairs = result->getCollisionPairs();
+ std::unordered_set<Collision::Representation*> representations;
+@@ -63,19 +69,28 @@
+
+ for (auto& representation : representations)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([interval, &representation]()
+ {
++#endif
+ representation->updateCcdData(interval);
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ }));
++#endif
+ }
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ for (auto& task : tasks)
+ {
+ task.get();
+ }
++#endif
+
+ return result;
+ }
+
+ }
+-}
+\ No newline at end of file
++}
+--- a/SurgSim/Physics/UpdateCollisionData.cpp
++++ b/SurgSim/Physics/UpdateCollisionData.cpp
+@@ -16,7 +16,10 @@
+ #include "SurgSim/Physics/UpdateCollisionData.h"
+
+ #include "SurgSim/Framework/Runtime.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Physics/PhysicsManagerState.h"
+ #include "SurgSim/Collision/Representation.h"
+
+@@ -44,23 +47,35 @@
+ {
+ std::shared_ptr<PhysicsManagerState> result = state;
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ auto threadPool = Framework::Runtime::getThreadPool();
+ std::vector<std::future<void>> tasks;
++#endif
+ auto& representations = result->getActiveCollisionRepresentations();
+ for (auto& representation : representations)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([dt, &representation]()
+ {
++#endif
+ representation->updateShapeData();
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ }));
++#endif
+ }
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ for (auto& task : tasks)
+ {
+ task.get();
+ }
++#endif
+
+ return result;
+ }
+
+ }
+-}
+\ No newline at end of file
++}
+--- a/SurgSim/Physics/UpdateCollisionRepresentations.cpp
++++ b/SurgSim/Physics/UpdateCollisionRepresentations.cpp
+@@ -14,7 +14,10 @@
+ // limitations under the License.
+
+ #include "SurgSim/Framework/Runtime.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Physics/UpdateCollisionRepresentations.h"
+ #include "SurgSim/Physics/PhysicsManagerState.h"
+ #include "SurgSim/Collision/Representation.h"
+@@ -39,17 +42,28 @@
+ {
+ std::shared_ptr<PhysicsManagerState> result = state;
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ auto threadPool = Framework::Runtime::getThreadPool();
+ std::vector<std::future<void>> tasks;
++#endif
+ auto& representations = result->getActiveCollisionRepresentations();
+ for (auto& representation : representations)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([dt, &representation]() { representation->update(dt); }));
++#else
++ representation->update(dt);
++#endif
+ }
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ for (auto& task : tasks)
+ {
+ task.get();
+ }
++#endif
+
+ return result;
+ }
+--- a/SurgSim/Physics/UpdateDcdData.cpp
++++ b/SurgSim/Physics/UpdateDcdData.cpp
+@@ -16,7 +16,10 @@
+ #include "SurgSim/Physics/UpdateDcdData.h"
+
+ #include "SurgSim/Framework/Runtime.h"
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ #include "SurgSim/Framework/ThreadPool.h"
++#endif
+ #include "SurgSim/Physics/PhysicsManagerState.h"
+ #include "SurgSim/Collision/Representation.h"
+
+@@ -46,8 +49,11 @@
+ {
+ std::shared_ptr<PhysicsManagerState> result = state;
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ auto threadPool = Framework::Runtime::getThreadPool();
+ std::vector<std::future<void>> tasks;
++#endif
+
+ const auto& pairs = result->getCollisionPairs();
+ std::unordered_set<Collision::Representation*> representations;
+@@ -63,19 +69,28 @@
+
+ for (auto representation : representations)
+ {
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ tasks.push_back(threadPool->enqueue<void>([dt, representation]()
+ {
++#endif
+ representation->updateDcdData();
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ }));
++#endif
+ }
+
++#if defined(_GLIBCXX_HAS_GTHREADS) && defined(_GLIBCXX_USE_C99_STDINT_TR1) \
++ && (ATOMIC_INT_LOCK_FREE > 1)
+ for (auto& task : tasks)
+ {
+ task.get();
+ }
++#endif
+
+ return result;
+ }
+
+ }
+-}
+\ No newline at end of file
++}
diff --git a/debian/patches/series b/debian/patches/series
index a436984..c488a3c 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ disable-sensitive-tests.patch
fix-hurd-build.patch
fix-rigid-representation-test.patch
fix-matrix-tests.patch
+disable-thread-pool-on-armel.patch
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-med/opensurgsim.git
More information about the debian-med-commit
mailing list