MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / startRead

Method startRead

physx/source/physx/src/NpScene.cpp:2630–2656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2628}
2629
2630bool NpScene::startRead() const
2631{
2632 if (mScene.getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK)
2633 {
2634 ThreadReadWriteCount localCounts (TlsGetValue(mThreadReadWriteDepth));
2635
2636 // ensure we already have the write or read lock
2637 return localCounts.writeLockDepth > 0 || localCounts.readLockDepth > 0;
2638 }
2639 else
2640 {
2641 Ps::atomicIncrement(&mConcurrentReadCount);
2642
2643 // update current threads read depth
2644 ThreadReadWriteCount localCounts (TlsGetValue(mThreadReadWriteDepth));
2645 localCounts.readDepth++;
2646 TlsSetValue(mThreadReadWriteDepth, localCounts.getData());
2647
2648 // success if the current thread is already performing a write (API re-entry) or no writes are in progress
2649 bool success = (localCounts.writeDepth > 0 || mConcurrentWriteCount == 0);
2650
2651 if (!success)
2652 Ps::atomicIncrement(&mConcurrentErrorCount);
2653
2654 return success;
2655 }
2656}
2657
2658void NpScene::stopRead() const
2659{

Callers 1

NpReadCheckMethod · 0.80

Calls 5

TlsGetValueFunction · 0.50
atomicIncrementFunction · 0.50
TlsSetValueFunction · 0.50
getFlagsMethod · 0.45
getDataMethod · 0.45

Tested by

no test coverage detected