VirtualBox

Changeset 25467 in vbox for trunk/src/VBox/Runtime/generic


Ignore:
Timestamp:
Dec 17, 2009 3:16:55 PM (15 years ago)
Author:
vboxsync
Message:

IPRT,PDMCritSect: More lock validation.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/critsect-generic.cpp

    r25409 r25467  
    244244    ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NativeThreadSelf);
    245245#ifdef RTCRITSECT_STRICT
    246     RTLockValidatorWriteLockInc(RTLockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS));
     246    RTLockValidatorSetOwner(pCritSect->pValidatorRec, ThreadSelf, uId, RT_SRC_POS_ARGS);
    247247#endif
    248248
     
    321321        for (;;)
    322322        {
    323             RTCRITSECT_STRICT_BLOCK(hThreadSelf, pCritSect->pValidatorRec, !(pCritSect->fFlags & RTCRITSECT_FLAGS_NO_NESTING));
     323#ifdef RTCRITSECT_STRICT
     324            int rc9 = RTLockValidatorCheckBlocking(pCritSect->pValidatorRec, hThreadSelf, RTTHREADSTATE_CRITSECT,
     325                                                   !(pCritSect->fFlags & RTCRITSECT_FLAGS_NO_NESTING),
     326                                                   uId, RT_SRC_POS_ARGS);
     327            if (RT_FAILURE(rc9))
     328            {
     329                ASMAtomicDecS32(&pCritSect->cLockers);
     330                return rc9;
     331            }
     332#else
     333            RTThreadBlocking(hThreadSelf, RTTHREADSTATE_CRITSECT);
     334#endif
     335
    324336            int rc = RTSemEventWait(pCritSect->EventSem, RT_INDEFINITE_WAIT);
    325             RTCRITSECT_STRICT_UNBLOCK(hThreadSelf);
     337
     338            RTThreadUnblocked(hThreadSelf, RTTHREADSTATE_CRITSECT);
    326339            if (pCritSect->u32Magic != RTCRITSECT_MAGIC)
    327340                return VERR_SEM_DESTROYED;
     
    339352    ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NativeThreadSelf);
    340353#ifdef RTCRITSECT_STRICT
    341     RTLockValidatorWriteLockInc(RTLockValidatorSetOwner(pCritSect->pValidatorRec, hThreadSelf, uId, RT_SRC_POS_ARGS));
     354    RTLockValidatorSetOwner(pCritSect->pValidatorRec, hThreadSelf, uId, RT_SRC_POS_ARGS);
    342355#endif
    343356
     
    392405         */
    393406#ifdef RTCRITSECT_STRICT
    394         RTLockValidatorWriteLockInc(RTLockValidatorUnsetOwner(pCritSect->pValidatorRec));
     407        RTLockValidatorUnsetOwner(pCritSect->pValidatorRec);
    395408#endif
    396409        ASMAtomicWriteHandle(&pCritSect->NativeThreadOwner, NIL_RTNATIVETHREAD);
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