VirtualBox

Changeset 25614 in vbox for trunk/src/VBox/Runtime/r3/linux


Ignore:
Timestamp:
Jan 1, 2010 2:19:06 PM (15 years ago)
Author:
vboxsync
Message:

iprt,pdmcritsect: More lock validator refactoring and debugging. Added hooks to semrw-generic.cpp. (Everything is still disabled.)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp

    r25607 r25614  
    176176    AssertReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, VERR_INVALID_HANDLE);
    177177
    178 #ifdef RTSEMMUTEX_STRICT
    179     RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt();
    180     RTLockValidatorCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos);
    181 #endif
    182 
    183178    /*
    184179     * Check if nested request.
     
    188183        &&  pThis->cNesting > 0)
    189184    {
     185#ifdef RTSEMMUTEX_STRICT
     186        int rc9 = RTLockValidatorRecExclRecursion(&pThis->ValidatorRec, pSrcPos);
     187        if (RT_FAILURE(rc9))
     188            return rc9;
     189#endif
    190190        ASMAtomicIncU32(&pThis->cNesting);
    191191        return VINF_SUCCESS;
    192192    }
    193 #ifndef RTSEMMUTEX_STRICT
     193
     194#ifdef RTSEMMUTEX_STRICT
     195    RTTHREAD hThreadSelf = RTThreadSelfAutoAdopt();
     196    if (cMillies)
     197    {
     198        int rc9 = RTLockValidatorRecExclCheckOrder(&pThis->ValidatorRec, hThreadSelf, pSrcPos);
     199        if (RT_FAILURE(rc9))
     200            return rc9;
     201    }
     202#else
    194203    RTTHREAD hThreadSelf = RTThreadSelf();
    195204#endif
     
    231240            {
    232241#ifdef RTSEMMUTEX_STRICT
    233                 int rc9 = RTLockValidatorCheckBlocking(&pThis->ValidatorRec, hThreadSelf,
    234                                                        RTTHREADSTATE_MUTEX, true, pSrcPos);
     242                int rc9 = RTLockValidatorRecExclCheckBlocking(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true);
    235243                if (RT_FAILURE(rc9))
    236244                    return rc9;
     
    299307    ASMAtomicWriteU32(&pThis->cNesting, 1);
    300308#ifdef RTSEMMUTEX_STRICT
    301     RTLockValidatorSetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos);
     309    RTLockValidatorRecExclSetOwner(&pThis->ValidatorRec, hThreadSelf, pSrcPos, true);
    302310#endif
    303311    return VINF_SUCCESS;
     
    354362    AssertReturn(pThis->u32Magic == RTSEMMUTEX_MAGIC, VERR_INVALID_HANDLE);
    355363
     364#ifdef RTSEMMUTEX_STRICT
     365    int rc9 = RTLockValidatorRecExclReleaseOwner(&pThis->ValidatorRec, pThis->cNestings != 1);
     366    if (RT_FAILURE(rc9))
     367        return rc9;
     368#endif
     369
    356370    /*
    357371     * Check if nested.
     
    378392     * Clear the state. (cNesting == 1)
    379393     */
    380 #ifdef RTSEMMUTEX_STRICT
    381     RTLockValidatorUnsetOwner(&pThis->ValidatorRec);
    382 #endif
    383394    pThis->Owner = (pthread_t)~0;
    384395    ASMAtomicWriteU32(&pThis->cNesting, 0);
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