From ed258ac043082ecba26444f1bbd1724c7fa97ead Mon Sep 17 00:00:00 2001 From: Markus Grotz <markus.grotz@kit.edu> Date: Thu, 9 Jul 2015 22:34:17 +0200 Subject: [PATCH] fixed scoped locks --- .../components/units/KinematicUnitSimulation.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/source/RobotAPI/components/units/KinematicUnitSimulation.cpp b/source/RobotAPI/components/units/KinematicUnitSimulation.cpp index 519eec8b6..bd85de32f 100644 --- a/source/RobotAPI/components/units/KinematicUnitSimulation.cpp +++ b/source/RobotAPI/components/units/KinematicUnitSimulation.cpp @@ -56,7 +56,7 @@ void KinematicUnitSimulation::onInitKinematicUnit() { // duplicate the loop because of locking - boost::mutex::scoped_lock(jointStatesMutex); + boost::mutex::scoped_lock lock(jointStatesMutex); // initialize JoinStates for (std::vector<VirtualRobot::RobotNodePtr>::iterator it = robotNodes.begin(); it != robotNodes.end(); it++) { @@ -98,7 +98,7 @@ void KinematicUnitSimulation::simulationFunction() bool aVelValueChanged = false; { - boost::mutex::scoped_lock(jointStatesMutex); + boost::mutex::scoped_lock lock(jointStatesMutex); for ( JointStates::iterator it = jointStates.begin(); it!=jointStates.end(); it++ ) { @@ -160,7 +160,7 @@ void KinematicUnitSimulation::switchControlMode(const NameControlModeMap& target bool aValueChanged = false; NameControlModeMap changedControlModes; { - boost::mutex::scoped_lock(jointStatesMutex); + boost::mutex::scoped_lock lock(jointStatesMutex); for ( NameControlModeMap::const_iterator it = targetJointModes.begin(); it!=targetJointModes.end(); it++ ) { // target values @@ -189,7 +189,7 @@ void KinematicUnitSimulation::switchControlMode(const NameControlModeMap& target void KinematicUnitSimulation::setJointAngles(const NameValueMap& targetJointAngles, const Ice::Current& c) { - boost::mutex::scoped_lock(jointStatesMutex); + boost::mutex::scoped_lock lock(jointStatesMutex); // name value maps for reporting NameValueMap actualJointAngles; bool aValueChanged = false; @@ -222,7 +222,7 @@ void KinematicUnitSimulation::setJointAngles(const NameValueMap& targetJointAngl void KinematicUnitSimulation::setJointVelocities(const NameValueMap& targetJointVelocities, const Ice::Current& c) { - boost::mutex::scoped_lock(jointStatesMutex); + boost::mutex::scoped_lock lock(jointStatesMutex); NameValueMap actualJointVelocities; bool aValueChanged = false; for ( NameValueMap::const_iterator it = targetJointVelocities.begin(); it!=targetJointVelocities.end(); it++ ) @@ -247,7 +247,7 @@ void KinematicUnitSimulation::setJointVelocities(const NameValueMap& targetJoint void KinematicUnitSimulation::setJointTorques(const NameValueMap& targetJointTorques, const Ice::Current& c) { - boost::mutex::scoped_lock(jointStatesMutex); + boost::mutex::scoped_lock lock(jointStatesMutex); NameValueMap actualJointTorques; bool aValueChanged = false; for ( NameValueMap::const_iterator it = targetJointTorques.begin(); it!=targetJointTorques.end(); it++ ) @@ -281,7 +281,7 @@ void KinematicUnitSimulation::setJointDecelerations(const NameValueMap& targetJo void KinematicUnitSimulation::stop(const Ice::Current &c) { - boost::mutex::scoped_lock(jointStatesMutex); + boost::mutex::scoped_lock lock(jointStatesMutex); for ( JointStates::iterator it = jointStates.begin(); it!=jointStates.end(); it++ ) { it->second.velocity = 0; -- GitLab