aboutsummaryrefslogtreecommitdiff
path: root/PhysX_3.4/Source/PhysX
diff options
context:
space:
mode:
authorSheikh Dawood Abdul Ajees <[email protected]>2018-02-12 15:31:42 -0600
committerSheikh Dawood Abdul Ajees <[email protected]>2018-02-12 15:31:42 -0600
commit52dae55c0c65f42caffa9d803be27be44ac4b8a3 (patch)
treec2fa77a97691d026593fe6aa45f1a56389fc5c70 /PhysX_3.4/Source/PhysX
parentPhysX 3.4, APEX 1.4 patch release @23472123 (diff)
downloadphysx-3.4-52dae55c0c65f42caffa9d803be27be44ac4b8a3.tar.xz
physx-3.4-52dae55c0c65f42caffa9d803be27be44ac4b8a3.zip
PhysX 3.4, APEX 1.4 patch release @23576764
Diffstat (limited to 'PhysX_3.4/Source/PhysX')
-rw-r--r--PhysX_3.4/Source/PhysX/src/NpScene.cpp15
1 files changed, 4 insertions, 11 deletions
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<void*>(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<ThreadReadWriteCount>(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<void*>(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();
}