From 52dae55c0c65f42caffa9d803be27be44ac4b8a3 Mon Sep 17 00:00:00 2001 From: Sheikh Dawood Abdul Ajees Date: Mon, 12 Feb 2018 15:31:42 -0600 Subject: PhysX 3.4, APEX 1.4 patch release @23576764 --- PhysX_3.4/Source/PhysX/src/NpScene.cpp | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) (limited to 'PhysX_3.4/Source/PhysX/src/NpScene.cpp') diff --git a/PhysX_3.4/Source/PhysX/src/NpScene.cpp b/PhysX_3.4/Source/PhysX/src/NpScene.cpp index 2afb7e08..52b89e21 100644 --- a/PhysX_3.4/Source/PhysX/src/NpScene.cpp +++ b/PhysX_3.4/Source/PhysX/src/NpScene.cpp @@ -2975,20 +2975,17 @@ void NpScene::lockRead(const char* /*file*/, PxU32 /*line*/) localCounts.readLockDepth++; TlsSet(mThreadReadWriteDepth, PxUnionCast(localCounts)); - // if we are the current writer then do nothing (allow reading from threads with write ownership) - if (mCurrentWriter == Thread::getId()) - return; - // only lock on first read + // if we are the current writer then increment the reader count but don't actually lock (allow reading from threads with write ownership) if (localCounts.readLockDepth == 1) - mRWLock.lockReader(); + mRWLock.lockReader(mCurrentWriter != Thread::getId()); } void NpScene::unlockRead() { // increment this threads read depth ThreadReadWriteCount localCounts = PxUnionCast(TlsGet(mThreadReadWriteDepth)); - if (localCounts.readLockDepth < 1) + if(localCounts.readLockDepth < 1) { Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, __FILE__, __LINE__, "PxScene::unlockRead() called without matching call to PxScene::lockRead(), behaviour will be undefined."); return; @@ -2996,12 +2993,8 @@ void NpScene::unlockRead() localCounts.readLockDepth--; TlsSet(mThreadReadWriteDepth, PxUnionCast(localCounts)); - // if we are the current writer then do nothing (allow reading from threads with write ownership) - if (mCurrentWriter == Thread::getId()) - return; - // only unlock on last read - if (localCounts.readLockDepth == 0) + if(localCounts.readLockDepth == 0) mRWLock.unlockReader(); } -- cgit v1.2.3