void JSLock::unlock(intptr_t unlockCount) { RELEASE_ASSERT(currentThreadIsHoldingLock()); ASSERT(m_lockCount >= unlockCount); m_lockCount -= unlockCount; if (!m_lockCount) { willReleaseLock(); if (!m_hasExclusiveThread) { m_ownerThreadID = std::thread::id(); m_lock.unlock(); } } }
void JSLock::unlock(intptr_t unlockCount) { RELEASE_ASSERT(currentThreadIsHoldingLock()); ASSERT(m_lockCount >= unlockCount); // Maintain m_lockCount while calling willReleaseLock() so that its callees know that // they still have the lock. if (unlockCount == m_lockCount) willReleaseLock(); m_lockCount -= unlockCount; if (!m_lockCount) { if (!m_hasExclusiveThread) { m_ownerThreadID = std::thread::id(); m_lock.unlock(); } } }