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

Method lockWrite

deps/physx/physx/source/physx/src/NpScene.cpp:2760–2780  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2758}
2759
2760void NpScene::lockWrite(const char* file, PxU32 line)
2761{
2762 // increment this threads write depth
2763 ThreadReadWriteCount localCounts (TlsGetValue(mThreadReadWriteDepth));
2764 if (localCounts.writeLockDepth == 0 && localCounts.readLockDepth > 0)
2765 {
2766 Ps::getFoundation().error(PxErrorCode::eINVALID_OPERATION, file?file:__FILE__, file?int(line):__LINE__, "PxScene::lockWrite() detected after a PxScene::lockRead(), lock upgrading is not supported, behaviour will be undefined.");
2767 return;
2768 }
2769 localCounts.writeLockDepth++;
2770 TlsSetValue(mThreadReadWriteDepth, localCounts.getData());
2771
2772 // only lock on first call
2773 if (localCounts.writeLockDepth == 1)
2774 mRWLock.lockWriter();
2775
2776 PX_ASSERT(mCurrentWriter == 0 || mCurrentWriter == Thread::getId());
2777
2778 // set ourselves as the current writer
2779 mCurrentWriter = Thread::getId();
2780}
2781
2782void NpScene::unlockWrite()
2783{

Callers 4

TickMethod · 0.80
onTickPreRenderMethod · 0.80
onTickPreRenderMethod · 0.80
PxSceneWriteLockMethod · 0.80

Calls 5

TlsGetValueFunction · 0.50
TlsSetValueFunction · 0.50
errorMethod · 0.45
getDataMethod · 0.45
lockWriterMethod · 0.45

Tested by

no test coverage detected