Changeset 25881 in vbox
- Timestamp:
- Jan 18, 2010 11:29:12 AM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56689
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/com/AutoLock.h
r25880 r25881 388 388 * 389 389 * In addition to utility methods for subclasses, this implements the public 390 * leave/enter/maybe Leave/maybeEnter methods, which are common to all390 * leave/enter/maybeEnter methods, which are common to all 391 391 * write locks. 392 392 */ … … 417 417 void leave(); 418 418 void enter(); 419 void maybeLeave();420 419 void maybeEnter(); 421 420 }; -
trunk/src/VBox/Main/glue/AutoLock.cpp
r25880 r25881 625 625 626 626 /** 627 * Same as #leave() but checks if the current thread actally owns the lock628 * and only proceeds in this case. As a result, as opposed to #leave(),629 * doesn't assert when called with no lock being held.630 */631 void AutoWriteLockBase::maybeLeave()632 {633 // unlock in reverse order!634 uint32_t i = m->aHandles.size();635 for (HandlesVector::reverse_iterator it = m->aHandles.rbegin();636 it != m->aHandles.rend();637 ++it)638 {639 --i; // array index is zero based, decrement with every loop since we iterate backwards640 LockHandle *pHandle = *it;641 if (pHandle)642 {643 if (pHandle->isWriteLockOnCurrentThread())644 {645 m->acUnlockedInLeave[i] = pHandle->writeLockLevel();646 AssertMsg(m->acUnlockedInLeave[i] >= 1, ("m->cUnlockedInLeave[%d] is %d, must be >=1!", i, m->acUnlockedInLeave[i]));647 648 for (uint32_t left = m->acUnlockedInLeave[i];649 left;650 --left)651 callUnlockImpl(*pHandle);652 }653 }654 ++i;655 }656 }657 658 /**659 627 * Same as #enter() but checks if the current thread actally owns the lock 660 628 * and only proceeds if not. As a result, as opposed to #enter(), doesn't
Note:
See TracChangeset
for help on using the changeset viewer.