| 2758 | } |
| 2759 | |
| 2760 | void 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 | |
| 2782 | void NpScene::unlockWrite() |
| 2783 | { |
no test coverage detected