MCPcopy Create free account
hub / github.com/RavEngine/RavEngine / startRead

Method startRead

deps/physx/physx/source/physx/src/NpScene.cpp:2680–2706  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2678}
2679
2680bool NpScene::startRead() const
2681{
2682 if (mScene.getFlags() & PxSceneFlag::eREQUIRE_RW_LOCK)
2683 {
2684 ThreadReadWriteCount localCounts (TlsGetValue(mThreadReadWriteDepth));
2685
2686 // ensure we already have the write or read lock
2687 return localCounts.writeLockDepth > 0 || localCounts.readLockDepth > 0;
2688 }
2689 else
2690 {
2691 Ps::atomicIncrement(&mConcurrentReadCount);
2692
2693 // update current threads read depth
2694 ThreadReadWriteCount localCounts (TlsGetValue(mThreadReadWriteDepth));
2695 localCounts.readDepth++;
2696 TlsSetValue(mThreadReadWriteDepth, localCounts.getData());
2697
2698 // success if the current thread is already performing a write (API re-entry) or no writes are in progress
2699 bool success = (localCounts.writeDepth > 0 || mConcurrentWriteCount == 0);
2700
2701 if (!success)
2702 Ps::atomicIncrement(&mConcurrentErrorCount);
2703
2704 return success;
2705 }
2706}
2707
2708void NpScene::stopRead() const
2709{

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