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

Method lockWrite

physx/source/physx/src/NpScene.cpp:2710–2730  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2708}
2709
2710void NpScene::lockWrite(const char* file, PxU32 line)
2711{
2712 // increment this threads write depth
2713 ThreadReadWriteCount localCounts (TlsGetValue(mThreadReadWriteDepth));
2714 if (localCounts.writeLockDepth == 0 && localCounts.readLockDepth > 0)
2715 {
2716 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.");
2717 return;
2718 }
2719 localCounts.writeLockDepth++;
2720 TlsSetValue(mThreadReadWriteDepth, localCounts.getData());
2721
2722 // only lock on first call
2723 if (localCounts.writeLockDepth == 1)
2724 mRWLock.lockWriter();
2725
2726 PX_ASSERT(mCurrentWriter == 0 || mCurrentWriter == Thread::getId());
2727
2728 // set ourselves as the current writer
2729 mCurrentWriter = Thread::getId();
2730}
2731
2732void NpScene::unlockWrite()
2733{

Callers 5

onTickPreRenderMethod · 0.80
onTickPreRenderMethod · 0.80
PxSceneWriteLockMethod · 0.80
preSimMethod · 0.80
~ActorMethod · 0.80

Calls 5

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

Tested by

no test coverage detected