瀏覽代碼

Sonar fix: Avoid explicitly specifying the template arguments by relying on the class template argument deduction.

Jorrit Rouwe 3 年之前
父節點
當前提交
a1e6c29248

+ 1 - 1
Jolt/Core/FixedSizeFreeList.inl

@@ -57,7 +57,7 @@ uint32 FixedSizeFreeList<Object>::ConstructObject(Parameters &&... inParameters)
 			if (first_free >= mNumObjectsAllocated)
 			{
 				// Allocate new page
-				lock_guard<Mutex> lock(mPageMutex);
+				lock_guard lock(mPageMutex);
 				while (first_free >= mNumObjectsAllocated)
 				{
 					uint32 next_page = mNumObjectsAllocated / mPageSize;

+ 2 - 2
Jolt/Core/JobSystemThreadPool.cpp

@@ -45,7 +45,7 @@ void JobSystemThreadPool::Semaphore::Release(uint inNumber)
 		::ReleaseSemaphore(mSemaphore, num_to_release, nullptr);
 	}
 #else
-	lock_guard<mutex> lock(mLock);
+	lock_guard lock(mLock);
 	mCount += (int)inNumber;
 	if (inNumber > 1)
 		mWaitVariable.notify_all();
@@ -68,7 +68,7 @@ void JobSystemThreadPool::Semaphore::Acquire(uint inNumber)
 			WaitForSingleObject(mSemaphore, INFINITE);
 	}
 #else
-	unique_lock<mutex> lock(mLock);
+	unique_lock lock(mLock);
 	mCount -= (int)inNumber;
 	mWaitVariable.wait(lock, [this]() { return mCount >= 0; });
 #endif

+ 3 - 3
Jolt/Core/Profiler.cpp

@@ -23,7 +23,7 @@ bool ProfileMeasurement::sOutOfSamplesReported = false;
 
 void Profiler::NextFrame()
 {
-	lock_guard<mutex> lock(mLock);
+	lock_guard lock(mLock);
 
 	if (mDump)
 	{
@@ -42,14 +42,14 @@ void Profiler::Dump()
 
 void Profiler::AddThread(ProfileThread *inThread)										
 { 
-	lock_guard<mutex> lock(mLock); 
+	lock_guard lock(mLock); 
 
 	mThreads.push_back(inThread); 
 }
 
 void Profiler::RemoveThread(ProfileThread *inThread)									
 { 
-	lock_guard<mutex> lock(mLock); 
+	lock_guard lock(mLock); 
 	
 	vector<ProfileThread *>::iterator i = find(mThreads.begin(), mThreads.end(), inThread); 
 	JPH_ASSERT(i != mThreads.end()); 

+ 5 - 5
Jolt/Core/StatCollector.cpp

@@ -33,7 +33,7 @@ string StatCollector::Variant::ToString() const
 
 void StatCollector::SetNextFrame()
 {
-	lock_guard<Mutex> lock(mMutex);
+	lock_guard lock(mMutex);
 
 	if (mIsCapturing)
 		mCurrentFrame = &mFrames[mCurrentFrameNumber++];
@@ -51,14 +51,14 @@ void StatCollector::ResetInternal()
 
 void StatCollector::Reset()
 {
-	lock_guard<Mutex> lock(mMutex);
+	lock_guard lock(mMutex);
 
 	ResetInternal();	
 }
 
 void StatCollector::StartCapture()
 {
-	lock_guard<Mutex> lock(mMutex);
+	lock_guard lock(mMutex);
 
 	ResetInternal();
 
@@ -67,7 +67,7 @@ void StatCollector::StartCapture()
 
 void StatCollector::AddItem(const string &inName, const Variant &inValue)
 {
-	lock_guard<Mutex> lock(mMutex);
+	lock_guard lock(mMutex);
 
 	JPH_ASSERT(mCurrentFrame != nullptr, "Don't forget to call SetFrame(...)");
 
@@ -139,7 +139,7 @@ static void sWriteStatTree(ofstream &ioStream, const StatTreeNode &inNode)
 
 void StatCollector::StopCapture(const char *inFileName)
 {
-	lock_guard<Mutex> lock(mMutex);
+	lock_guard lock(mMutex);
 
 	// Stop capturing
 	mIsCapturing = false;

+ 16 - 16
Jolt/Physics/Body/BodyManager.cpp

@@ -24,7 +24,7 @@ namespace JPH {
 
 BodyManager::~BodyManager()
 {
-	UniqueLock<Mutex> lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
+	UniqueLock lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
 
 	// Destroy any bodies that are still alive
 	for (Body *b : mBodies)
@@ -36,7 +36,7 @@ BodyManager::~BodyManager()
 
 void BodyManager::Init(uint inMaxBodies)
 {
-	UniqueLock<Mutex> lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
+	UniqueLock lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
 
 	// Allocate space for bodies
 	mBodies.reserve(inMaxBodies);
@@ -51,14 +51,14 @@ void BodyManager::Init(uint inMaxBodies)
 
 uint BodyManager::GetNumBodies() const
 {
-	UniqueLock<Mutex> lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
+	UniqueLock lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
 
 	return mNumBodies;
 }
 
 BodyManager::BodyStats BodyManager::GetBodyStats() const
 {
-	UniqueLock<Mutex> lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
+	UniqueLock lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
 
 	BodyStats stats;
 	stats.mNumBodies = mNumBodies;
@@ -95,7 +95,7 @@ Body *BodyManager::CreateBody(const BodyCreationSettings &inBodyCreationSettings
 	// Determine next free index
 	uint32 idx;
 	{
-		UniqueLock<Mutex> lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
+		UniqueLock lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
 
 		if (mBodyIDFreeListStart != cBodyIDFreeListEnd)
 		{
@@ -171,7 +171,7 @@ void BodyManager::DestroyBodies(const BodyID *inBodyIDs, int inNumber)
 	if (inNumber <= 0)
 		return;
 
-	UniqueLock<Mutex> lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
+	UniqueLock lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
 
 	// Update cached number of bodies
 	JPH_ASSERT(mNumBodies >= (uint)inNumber);
@@ -215,7 +215,7 @@ void BodyManager::ActivateBodies(const BodyID *inBodyIDs, int inNumber)
 	if (inNumber <= 0)
 		return;
 
-	UniqueLock<Mutex> lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
+	UniqueLock lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
 
 	JPH_ASSERT(!mActiveBodiesLocked || sOverrideAllowActivation);
 
@@ -254,7 +254,7 @@ void BodyManager::DeactivateBodies(const BodyID *inBodyIDs, int inNumber)
 	if (inNumber <= 0)
 		return;
 
-	UniqueLock<Mutex> lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
+	UniqueLock lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
 
 	JPH_ASSERT(!mActiveBodiesLocked || sOverrideAllowDeactivation);
 
@@ -309,7 +309,7 @@ void BodyManager::GetActiveBodies(BodyIDVector &outBodyIDs) const
 {
 	JPH_PROFILE_FUNCTION();
 
-	UniqueLock<Mutex> lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
+	UniqueLock lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
 
 	outBodyIDs.assign(mActiveBodies, mActiveBodies + mNumActiveBodies);
 }
@@ -318,7 +318,7 @@ void BodyManager::GetBodyIDs(BodyIDVector &outBodies) const
 {
 	JPH_PROFILE_FUNCTION();
 
-	UniqueLock<Mutex> lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
+	UniqueLock lock(mBodiesMutex, EPhysicsLockTypes::BodiesList);
 
 	// Reserve space for all bodies
 	outBodies.clear();
@@ -335,7 +335,7 @@ void BodyManager::GetBodyIDs(BodyIDVector &outBodies) const
 
 void BodyManager::SetBodyActivationListener(BodyActivationListener *inListener)	
 { 
-	UniqueLock<Mutex> lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
+	UniqueLock lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
 
 	mActivationListener = inListener; 
 }
@@ -442,7 +442,7 @@ void BodyManager::SaveState(StateRecorder &inStream) const
 	}
 
 	{
-		UniqueLock<Mutex> lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
+		UniqueLock lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
 
 		// Write active bodies, sort because activation can come from multiple threads, so order is not deterministic
 		inStream.Write(mNumActiveBodies);
@@ -492,7 +492,7 @@ bool BodyManager::RestoreState(StateRecorder &inStream)
 	}
 
 	{
-		UniqueLock<Mutex> lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
+		UniqueLock lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
 
 		// Mark current active bodies as deactivated
 		for (BodyID *id = mActiveBodies, *id_end = mActiveBodies + mNumActiveBodies; id < id_end; ++id)
@@ -735,7 +735,7 @@ void BodyManager::Draw(const DrawSettings &inDrawSettings, const PhysicsSettings
 
 void BodyManager::InvalidateContactCacheForBody(Body &ioBody)
 {
-	lock_guard<Mutex> lock(mBodiesCacheInvalidMutex);
+	lock_guard lock(mBodiesCacheInvalidMutex);
 	
 	if (!ioBody.IsCollisionCacheInvalid())
 	{
@@ -746,7 +746,7 @@ void BodyManager::InvalidateContactCacheForBody(Body &ioBody)
 
 void BodyManager::ValidateContactCacheForAllBodies()
 {
-	lock_guard<Mutex> lock(mBodiesCacheInvalidMutex);
+	lock_guard lock(mBodiesCacheInvalidMutex);
 	
 	for (const BodyID &b : mBodiesCacheInvalid)
 	{
@@ -789,7 +789,7 @@ void BodyManager::CollectStats() const
 #ifdef _DEBUG
 void BodyManager::ValidateActiveBodyBounds()
 {
-	UniqueLock<Mutex> lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
+	UniqueLock lock(mActiveBodiesMutex, EPhysicsLockTypes::ActiveBodiesList);
 
 	for (BodyID *id = mActiveBodies, *id_end = mActiveBodies + mNumActiveBodies; id < id_end; ++id)
 	{

+ 9 - 9
Jolt/Physics/Collision/BroadPhase/BroadPhaseBruteForce.cpp

@@ -15,7 +15,7 @@ namespace JPH {
 	
 void BroadPhaseBruteForce::AddBodiesFinalize(BodyID *ioBodies, int inNumber, AddState inAddState)
 { 
-	lock_guard<SharedMutex> lock(mMutex);
+	lock_guard lock(mMutex);
 
 	BodyVector &bodies = mBodyManager->GetBodies();
 
@@ -46,7 +46,7 @@ void BroadPhaseBruteForce::AddBodiesFinalize(BodyID *ioBodies, int inNumber, Add
 	
 void BroadPhaseBruteForce::RemoveBodies(BodyID *ioBodies, int inNumber) 
 { 
-	lock_guard<SharedMutex> lock(mMutex);
+	lock_guard lock(mMutex);
 
 	BodyVector &bodies = mBodyManager->GetBodies();
 
@@ -85,7 +85,7 @@ void BroadPhaseBruteForce::NotifyBodiesLayerChanged(BodyID * ioBodies, int inNum
 
 void BroadPhaseBruteForce::CastRay(const RayCast &inRay, RayCastBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const
 { 
-	shared_lock<SharedMutex> lock(mMutex);
+	shared_lock lock(mMutex);
 
 	// Load ray
 	Vec3 origin(inRay.mOrigin);
@@ -118,7 +118,7 @@ void BroadPhaseBruteForce::CastRay(const RayCast &inRay, RayCastBodyCollector &i
 
 void BroadPhaseBruteForce::CollideAABox(const AABox &inBox, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const 
 {
-	shared_lock<SharedMutex> lock(mMutex);
+	shared_lock lock(mMutex);
 
 	// For all bodies
 	for (BodyID b : mBodyIDs)
@@ -143,7 +143,7 @@ void BroadPhaseBruteForce::CollideAABox(const AABox &inBox, CollideShapeBodyColl
 
 void BroadPhaseBruteForce::CollideSphere(Vec3Arg inCenter, float inRadius, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const
 {
-	shared_lock<SharedMutex> lock(mMutex);
+	shared_lock lock(mMutex);
 
 	float radius_sq = Square(inRadius);
 
@@ -170,7 +170,7 @@ void BroadPhaseBruteForce::CollideSphere(Vec3Arg inCenter, float inRadius, Colli
 
 void BroadPhaseBruteForce::CollidePoint(Vec3Arg inPoint, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const
 {
-	shared_lock<SharedMutex> lock(mMutex);
+	shared_lock lock(mMutex);
 
 	// For all bodies
 	for (BodyID b : mBodyIDs)
@@ -195,7 +195,7 @@ void BroadPhaseBruteForce::CollidePoint(Vec3Arg inPoint, CollideShapeBodyCollect
 
 void BroadPhaseBruteForce::CollideOrientedBox(const OrientedBox &inBox, CollideShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const
 {
-	shared_lock<SharedMutex> lock(mMutex);
+	shared_lock lock(mMutex);
 
 	// For all bodies
 	for (BodyID b : mBodyIDs)
@@ -220,7 +220,7 @@ void BroadPhaseBruteForce::CollideOrientedBox(const OrientedBox &inBox, CollideS
 
 void BroadPhaseBruteForce::CastAABox(const AABoxCast &inBox, CastShapeBodyCollector &ioCollector, const BroadPhaseLayerFilter &inBroadPhaseLayerFilter, const ObjectLayerFilter &inObjectLayerFilter) const
 {
-	shared_lock<SharedMutex> lock(mMutex);
+	shared_lock lock(mMutex);
 
 	// Load box
 	Vec3 origin(inBox.mBox.GetCenter());
@@ -254,7 +254,7 @@ void BroadPhaseBruteForce::CastAABox(const AABoxCast &inBox, CastShapeBodyCollec
 
 void BroadPhaseBruteForce::FindCollidingPairs(BodyID *ioActiveBodies, int inNumActiveBodies, float inSpeculativeContactDistance, ObjectVsBroadPhaseLayerFilter inObjectVsBroadPhaseLayerFilter, ObjectLayerPairFilter inObjectLayerPairFilter, BodyPairCollector &ioPairCollector) const
 {
-	shared_lock<SharedMutex> lock(mMutex);
+	shared_lock lock(mMutex);
 
 	// Loop through all active bodies
 	size_t num_bodies = mBodyIDs.size();

+ 8 - 8
Jolt/Physics/Constraints/ConstraintManager.cpp

@@ -13,7 +13,7 @@ namespace JPH {
 
 void ConstraintManager::Add(Constraint **inConstraints, int inNumber)						
 { 
-	UniqueLock<Mutex> lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
+	UniqueLock lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
 
 	mConstraints.reserve(mConstraints.size() + inNumber);
 
@@ -32,7 +32,7 @@ void ConstraintManager::Add(Constraint **inConstraints, int inNumber)
 
 void ConstraintManager::Remove(Constraint **inConstraints, int inNumber)
 {
-	UniqueLock<Mutex> lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
+	UniqueLock lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
 
 	for (Constraint **c = inConstraints, **c_end = inConstraints + inNumber; c < c_end; ++c)
 	{
@@ -161,7 +161,7 @@ void ConstraintManager::CollectStats() const
 {
 	JPH_PROFILE_FUNCTION();
 
-	UniqueLock<Mutex> lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
+	UniqueLock lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
 
 	for (const Ref<Constraint> &c : mConstraints)			
 		c->CollectStats();
@@ -173,7 +173,7 @@ void ConstraintManager::DrawConstraints(DebugRenderer *inRenderer) const
 {
 	JPH_PROFILE_FUNCTION();
 
-	UniqueLock<Mutex> lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
+	UniqueLock lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
 
 	for (const Ref<Constraint> &c : mConstraints)			
 		c->DrawConstraint(inRenderer);
@@ -183,7 +183,7 @@ void ConstraintManager::DrawConstraintLimits(DebugRenderer *inRenderer) const
 {
 	JPH_PROFILE_FUNCTION();
 
-	UniqueLock<Mutex> lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
+	UniqueLock lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
 
 	for (const Ref<Constraint> &c : mConstraints)
 		c->DrawConstraintLimits(inRenderer);
@@ -193,7 +193,7 @@ void ConstraintManager::DrawConstraintReferenceFrame(DebugRenderer *inRenderer)
 {
 	JPH_PROFILE_FUNCTION();
 
-	UniqueLock<Mutex> lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
+	UniqueLock lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
 
 	for (const Ref<Constraint> &c : mConstraints)
 		c->DrawConstraintReferenceFrame(inRenderer);
@@ -202,7 +202,7 @@ void ConstraintManager::DrawConstraintReferenceFrame(DebugRenderer *inRenderer)
 
 void ConstraintManager::SaveState(StateRecorder &inStream) const
 {	
-	UniqueLock<Mutex> lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
+	UniqueLock lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
 
 	// Write state of constraints
 	size_t num_constraints = mConstraints.size();
@@ -213,7 +213,7 @@ void ConstraintManager::SaveState(StateRecorder &inStream) const
 
 bool ConstraintManager::RestoreState(StateRecorder &inStream)
 {
-	UniqueLock<Mutex> lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
+	UniqueLock lock(mConstraintsMutex, EPhysicsLockTypes::ConstraintsList);
 
 	// Read state of constraints
 	size_t num_constraints = mConstraints.size(); // Initialize to current value for validation

+ 2 - 2
Jolt/Physics/PhysicsSystem.cpp

@@ -98,7 +98,7 @@ void PhysicsSystem::OptimizeBroadPhase()
 
 void PhysicsSystem::AddStepListener(PhysicsStepListener *inListener)
 {
-	lock_guard<Mutex> lock(mStepListenersMutex);
+	lock_guard lock(mStepListenersMutex);
 
 	JPH_ASSERT(find(mStepListeners.begin(), mStepListeners.end(), inListener) == mStepListeners.end());
 	mStepListeners.push_back(inListener);
@@ -106,7 +106,7 @@ void PhysicsSystem::AddStepListener(PhysicsStepListener *inListener)
 
 void PhysicsSystem::RemoveStepListener(PhysicsStepListener *inListener)
 {
-	lock_guard<Mutex> lock(mStepListenersMutex);
+	lock_guard lock(mStepListenersMutex);
 
 	StepListeners::iterator i = find(mStepListeners.begin(), mStepListeners.end(), inListener);
 	JPH_ASSERT(i != mStepListeners.end());

+ 3 - 3
Samples/Tests/General/SensorTest.cpp

@@ -71,7 +71,7 @@ void SensorTest::Initialize()
 
 void SensorTest::PrePhysicsUpdate(const PreUpdateParams &inParams)
 {
-	lock_guard<Mutex> lock(mMutex);
+	lock_guard lock(mMutex);
 
 	Vec3 center(0, 10, 0);
 	float centrifugal_force = 10.0f;
@@ -116,7 +116,7 @@ void SensorTest::OnContactAdded(const Body &inBody1, const Body &inBody2, const
 		return;
 
 	// Add to list and make sure that the list remains sorted for determinism (contacts can be added from multiple threads)
-	lock_guard<Mutex> lock(mMutex);
+	lock_guard lock(mMutex);
 	BodyAndCount body_and_count { body_id, 1 };
 	BodiesInSensor::iterator b = lower_bound(mBodiesInSensor.begin(), mBodiesInSensor.end(), body_and_count);
 	if (b != mBodiesInSensor.end() && b->mBodyID == body_id)
@@ -140,7 +140,7 @@ void SensorTest::OnContactRemoved(const SubShapeIDPair &inSubShapePair)
 		return;
 
 	// Remove from list
-	lock_guard<Mutex> lock(mMutex);
+	lock_guard lock(mMutex);
 	BodyAndCount body_and_count { body_id, 1 };
 	BodiesInSensor::iterator b = lower_bound(mBodiesInSensor.begin(), mBodiesInSensor.end(), body_and_count);
 	if (b != mBodiesInSensor.end() && b->mBodyID == body_id)

+ 4 - 4
Samples/Utils/ContactListenerImpl.cpp

@@ -38,7 +38,7 @@ void ContactListenerImpl::OnContactAdded(const Body &inBody1, const Body &inBody
 
 	// Insert new manifold into state map
 	{
-		lock_guard<Mutex> lock(mStateMutex);
+		lock_guard lock(mStateMutex);
 		SubShapeIDPair key(inBody1.GetID(), inManifold.mSubShapeID1, inBody2.GetID(), inManifold.mSubShapeID2);
 		if (mState.find(key) != mState.end())
 			JPH_BREAKPOINT; // Added contact that already existed
@@ -63,7 +63,7 @@ void ContactListenerImpl::OnContactPersisted(const Body &inBody1, const Body &in
 
 	// Update existing manifold in state map
 	{
-		lock_guard<Mutex> lock(mStateMutex);
+		lock_guard lock(mStateMutex);
 		SubShapeIDPair key(inBody1.GetID(), inManifold.mSubShapeID1, inBody2.GetID(), inManifold.mSubShapeID2);
 		StateMap::iterator i = mState.find(key);
 		if (i != mState.end())
@@ -86,7 +86,7 @@ void ContactListenerImpl::OnContactRemoved(const SubShapeIDPair &inSubShapePair)
 
 	// Update existing manifold in state map
 	{
-		lock_guard<Mutex> lock(mStateMutex);
+		lock_guard lock(mStateMutex);
 		StateMap::iterator i = mState.find(inSubShapePair);
 		if (i != mState.end())
 			mState.erase(i);
@@ -180,7 +180,7 @@ void ContactListenerImpl::DrawState()
 {
 	Trace("Draw Contact State");
 
-	lock_guard<Mutex> lock(mStateMutex);
+	lock_guard lock(mStateMutex);
 	for (const StateMap::value_type &kv : mState)
 		for (Vec3 v : kv.second)
 			DebugRenderer::sInstance->DrawWireSphere(v, 0.05f, Color::sRed, 1);

+ 10 - 10
TestFramework/Renderer/DebugRendererImp.cpp

@@ -82,7 +82,7 @@ DebugRendererImp::DebugRendererImp(Renderer *inRenderer, const Font *inFont) :
 
 void DebugRendererImp::DrawLine(const Float3 &inFrom, const Float3 &inTo, ColorArg inColor) 
 { 
-	lock_guard<Mutex> lock(mLinesLock); 
+	lock_guard lock(mLinesLock); 
 	mLines.push_back(Line(inFrom, inTo, inColor)); 
 }
 
@@ -111,7 +111,7 @@ DebugRenderer::Batch DebugRendererImp::CreateTriangleBatch(const Vertex *inVerti
 
 void DebugRendererImp::DrawGeometry(Mat44Arg inModelMatrix, const AABox &inWorldSpaceBounds, float inLODScaleSq, ColorArg inModelColor, const GeometryRef &inGeometry, ECullMode inCullMode, ECastShadow inCastShadow, EDrawMode inDrawMode)
 {
-	lock_guard<Mutex> lock(mPrimitivesLock); 
+	lock_guard lock(mPrimitivesLock); 
 	   
 	// Our pixel shader uses alpha only to turn on/off shadows
 	Color color = inCastShadow == ECastShadow::On? Color(inModelColor, 255) : Color(inModelColor, 0);
@@ -186,7 +186,7 @@ void DebugRendererImp::EnsurePrimitiveSpace(int inVtxSize)
 
 void DebugRendererImp::DrawTriangle(Vec3Arg inV1, Vec3Arg inV2, Vec3Arg inV3, ColorArg inColor)
 {
-	lock_guard<Mutex> lock(mPrimitivesLock); 
+	lock_guard lock(mPrimitivesLock); 
 
 	EnsurePrimitiveSpace(3);
 
@@ -228,7 +228,7 @@ void DebugRendererImp::DrawInstances(const Geometry *inGeometry, const vector<in
 
 void DebugRendererImp::DrawText3D(Vec3Arg inPosition, const string &inString, ColorArg inColor, float inHeight)
 { 	
-	lock_guard<Mutex> lock(mTextsLock);  
+	lock_guard lock(mTextsLock);  
 	mTexts.emplace_back(inPosition, inString, inColor, inHeight); 
 }
 
@@ -236,7 +236,7 @@ void DebugRendererImp::DrawLines()
 {
 	JPH_PROFILE_FUNCTION();
 
-	lock_guard<Mutex> lock(mLinesLock); 
+	lock_guard lock(mLinesLock); 
 
 	// Draw the lines
 	if (!mLines.empty())
@@ -255,7 +255,7 @@ void DebugRendererImp::DrawTriangles()
 {
 	JPH_PROFILE_FUNCTION();
 
-	lock_guard<Mutex> lock(mPrimitivesLock); 
+	lock_guard lock(mPrimitivesLock); 
 
 	// Finish the last primitive
 	FinalizePrimitive();
@@ -432,7 +432,7 @@ void DebugRendererImp::DrawTriangles()
 
 void DebugRendererImp::DrawTexts()
 {
-	lock_guard<Mutex> lock(mTextsLock); 
+	lock_guard lock(mTextsLock); 
 
 	JPH_PROFILE_FUNCTION();
 
@@ -458,7 +458,7 @@ void DebugRendererImp::Draw()
 
 void DebugRendererImp::ClearLines()
 { 
-	lock_guard<Mutex> lock(mLinesLock); 
+	lock_guard lock(mLinesLock); 
 	mLines.clear(); 
 }
 
@@ -480,7 +480,7 @@ void DebugRendererImp::ClearMap(InstanceMap &ioInstances)
 
 void DebugRendererImp::ClearTriangles()
 { 
-	lock_guard<Mutex> lock(mPrimitivesLock); 
+	lock_guard lock(mPrimitivesLock); 
 
 	// Close any primitive that's being built
 	FinalizePrimitive(); 
@@ -495,7 +495,7 @@ void DebugRendererImp::ClearTriangles()
 
 void DebugRendererImp::ClearTexts()
 {
-	lock_guard<Mutex> lock(mTextsLock); 
+	lock_guard lock(mTextsLock); 
 	mTexts.clear();
 }
 

+ 2 - 2
UnitTests/LoggingBodyActivationListener.h

@@ -26,13 +26,13 @@ public:
 
 	virtual void		OnBodyActivated(const BodyID &inBodyID, void *inBodyUserData) override
 	{
-		lock_guard<Mutex> lock(mLogMutex);
+		lock_guard lock(mLogMutex);
 		mLog.push_back({ EType::Activated, inBodyID });
 	}
 
 	virtual void		OnBodyDeactivated(const BodyID &inBodyID, void *inBodyUserData) override
 	{
-		lock_guard<Mutex> lock(mLogMutex);
+		lock_guard lock(mLogMutex);
 		mLog.push_back({ EType::Deactivated, inBodyID });
 	}
 

+ 4 - 4
UnitTests/LoggingContactListener.h

@@ -32,7 +32,7 @@ public:
 		// Check contract that body 1 is dynamic
 		CHECK(inBody1.IsDynamic());
 
-		lock_guard<Mutex> lock(mLogMutex);
+		lock_guard lock(mLogMutex);
 		mLog.push_back({ EType::Validate, inBody1.GetID(), inBody2.GetID(), ContactManifold() });
 		return ValidateResult::AcceptContact;
 	}
@@ -42,7 +42,7 @@ public:
 		// Check contract that body 1 < body 2
 		CHECK(inBody1.GetID() < inBody2.GetID());
 
-		lock_guard<Mutex> lock(mLogMutex);
+		lock_guard lock(mLogMutex);
 		SubShapeIDPair key(inBody1.GetID(), inManifold.mSubShapeID1, inBody2.GetID(), inManifold.mSubShapeID2);
 		CHECK(mExistingContacts.insert(key).second); // Validate that contact does not exist yet
 		mLog.push_back({ EType::Add, inBody1.GetID(), inBody2.GetID(), inManifold });
@@ -53,7 +53,7 @@ public:
 		// Check contract that body 1 < body 2
 		CHECK(inBody1.GetID() < inBody2.GetID());
 
-		lock_guard<Mutex> lock(mLogMutex);
+		lock_guard lock(mLogMutex);
 		SubShapeIDPair key(inBody1.GetID(), inManifold.mSubShapeID1, inBody2.GetID(), inManifold.mSubShapeID2);
 		CHECK(mExistingContacts.find(key) != mExistingContacts.end()); // Validate that OnContactAdded was called
 		mLog.push_back({ EType::Persist, inBody1.GetID(), inBody2.GetID(), inManifold });
@@ -64,7 +64,7 @@ public:
 		// Check contract that body 1 < body 2
 		CHECK(inSubShapePair.GetBody1ID() < inSubShapePair.GetBody2ID());
 
-		lock_guard<Mutex> lock(mLogMutex);
+		lock_guard lock(mLogMutex);
 		CHECK(mExistingContacts.erase(inSubShapePair) == 1); // Validate that OnContactAdded was called
 		mLog.push_back({ EType::Remove, inSubShapePair.GetBody1ID(), inSubShapePair.GetBody2ID(), ContactManifold() });
 	}