Swap mDependents with mReferencesToRemove when refcount goes to 0. */
| 135 | Swap mDependents with mReferencesToRemove when refcount goes to 0. |
| 136 | */ |
| 137 | virtual void removeReference() |
| 138 | { |
| 139 | shdfnd::Mutex::ScopedLock lock(mMutex); |
| 140 | if (!physx::shdfnd::atomicDecrement(&mRefCount)) |
| 141 | { |
| 142 | // prevents access to mReferencesToRemove until release |
| 143 | physx::shdfnd::atomicIncrement(&mRefCount); |
| 144 | mNotifySubmission = false; |
| 145 | PX_ASSERT(mReferencesToRemove.empty()); |
| 146 | for (PxU32 i = 0; i < mDependents.size(); i++) |
| 147 | mReferencesToRemove.pushBack(mDependents[i]); |
| 148 | mDependents.clear(); |
| 149 | mTm->getCpuDispatcher()->submitTask(*this); |
| 150 | } |
| 151 | } |
| 152 | |
| 153 | /** |
| 154 | \brief Increases reference count |
no test coverage detected