VirtualBox

Changeset 25736 in vbox


Ignore:
Timestamp:
Jan 11, 2010 5:16:46 PM (15 years ago)
Author:
vboxsync
Message:

Main: Forward locking location info to the IPRT API. Added a todo with some hints about how to go about implementing locking ordering.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/AutoLock.cpp

    r25408 r25736  
    252252{
    253253    m = new Data();
     254/** @todo Lock order validation: There are two options here:
     255 *  -# Use one RTLOCKVALCLASS (share it with WriteLockHandle) and then use
     256 *     sub-classes (integers) to deal with lock ordering.
     257 *  -# Use different classes (RTLOCKVALCLASS) for each object and only use
     258 *     sub-classes to deal with things like the media tree.
     259 */
     260
    254261    int vrc = RTSemRWCreate(&m->sem);
    255262    AssertRC(vrc);
     
    276283    validateLock(LOCKVAL_SRC_POS_ARGS);
    277284#endif
     285#if defined(RT_STRICT) && defined(VBOX_WITH_DEBUG_LOCK_VALIDATOR)
     286    int vrc = RTSemRWRequestWriteDebug(m->sem, RT_INDEFINITE_WAIT, (uintptr_t)ASMReturnAddress(), RT_SRC_POS_ARGS);
     287#elif defined(RT_STRICT)
     288    int vrc = RTSemRWRequestWriteDebug(m->sem, RT_INDEFINITE_WAIT, (uintptr_t)ASMReturnAddress(), RT_SRC_POS);
     289#else
    278290    int vrc = RTSemRWRequestWrite(m->sem, RT_INDEFINITE_WAIT);
     291#endif
    279292    AssertRC(vrc);
    280293}
     
    295308    validateLock(LOCKVAL_SRC_POS_ARGS);
    296309#endif
     310#if defined(RT_STRICT) && defined(VBOX_WITH_DEBUG_LOCK_VALIDATOR)
     311    int vrc = RTSemRWRequestReadDebug(m->sem, RT_INDEFINITE_WAIT, (uintptr_t)ASMReturnAddress(), RT_SRC_POS_ARGS);
     312#elif defined(RT_STRICT)
     313    int vrc = RTSemRWRequestReadDebug(m->sem, RT_INDEFINITE_WAIT, (uintptr_t)ASMReturnAddress(), RT_SRC_POS);
     314#else
    297315    int vrc = RTSemRWRequestRead(m->sem, RT_INDEFINITE_WAIT);
     316#endif
    298317    AssertRC(vrc);
    299318}
     
    310329/*virtual*/ uint32_t RWLockHandle::writeLockLevel() const
    311330{
     331    /* Note! This does not include read recursions done by the writer! */
    312332    return RTSemRWGetWriteRecursion(m->sem);
    313333}
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette