From 50dca7cf0ee2b15ea5c9d406d99a73f33bc77711 Mon Sep 17 00:00:00 2001 From: jamoflaw Date: Mon, 27 May 2019 23:05:20 +0100 Subject: [PATCH 1/2] Destroy semaphore after join I can't quite work out the logic behind this fix though I get a consistent hang on the worker threads (both my worker threads get stuck on sem_wait() - Line 181) when the semaphore is destroyed before the thread is joined, and the application never exits. This change resolves this. --- src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp b/src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp index d80af09c7..a03f6dc57 100644 --- a/src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp +++ b/src/LinearMath/TaskScheduler/btThreadSupportPosix.cpp @@ -304,8 +304,8 @@ void btThreadSupportPosix::stopThreads() checkPThreadFunction(sem_post(threadStatus.startSemaphore)); checkPThreadFunction(sem_wait(m_mainSemaphore)); - destroySem(threadStatus.startSemaphore); checkPThreadFunction(pthread_join(threadStatus.thread, 0)); + destroySem(threadStatus.startSemaphore); } destroySem(m_mainSemaphore); m_activeThreadStatus.clear(); From 960cadd9192f8e8460def8192b9b0f850040f5d3 Mon Sep 17 00:00:00 2001 From: Andrea Catania Date: Mon, 3 Jun 2019 12:54:19 +0200 Subject: [PATCH 2/2] Fix initialization order This commit is necessary in order to fix the error that we get in godot with the flag: "-Werror=reorder" --- .../ConstraintSolver/btSequentialImpulseConstraintSolver.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h b/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h index 542ea23c9..2b88e25be 100644 --- a/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h +++ b/src/BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h @@ -80,11 +80,11 @@ struct btSISolverSingleIterationData m_orderNonContactConstraintPool(orderNonContactConstraintPool), m_orderFrictionConstraintPool(orderFrictionConstraintPool), m_tmpConstraintSizesPool(tmpConstraintSizesPool), + m_seed(seed), m_resolveSingleConstraintRowGeneric(resolveSingleConstraintRowGeneric), m_resolveSingleConstraintRowLowerLimit(resolveSingleConstraintRowLowerLimit), m_resolveSplitPenetrationImpulse(resolveSplitPenetrationImpulse), m_kinematicBodyUniqueIdToSolverBodyTable(kinematicBodyUniqueIdToSolverBodyTable), - m_seed(seed), m_fixedBodyId(fixedBodyId), m_maxOverrideNumSolverIterations(maxOverrideNumSolverIterations) { @@ -320,4 +320,4 @@ public: btSolverAnalyticsData m_analyticsData; }; -#endif //BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H \ No newline at end of file +#endif //BT_SEQUENTIAL_IMPULSE_CONSTRAINT_SOLVER_H