VirtualBox

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


Ignore:
Timestamp:
Jan 4, 2010 4:08:04 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56338
Message:

iprt,pdmcritsect: Added RTSemEvent[Set|Add|Remove]Signaller so that we can validate who is signalling an event if we like and, more importantly, detect deadlocks involving event semaphores. More attempts at dealing with the races (and bugs) in the all-other-threads-blocking detection in tstRTLockValidator.cpp, adding RTThreadGetReallySleeping and RTThreadGetNativeState in the process.

Location:
trunk/src/VBox/Runtime/generic
Files:
1 added
2 edited

Legend:

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

    r25618 r25638  
    208208        {
    209209#ifdef RTCRITSECT_STRICT
    210             int rc9 = RTLockValidatorRecExclCheckBlocking(pCritSect->pValidatorRec, hThreadSelf, pSrcPos,
    211                                                           !(pCritSect->fFlags & RTCRITSECT_FLAGS_NO_NESTING),
    212                                                           RTTHREADSTATE_CRITSECT);
     210            rc9 = RTLockValidatorRecExclCheckBlocking(pCritSect->pValidatorRec, hThreadSelf, pSrcPos,
     211                                                      !(pCritSect->fFlags & RTCRITSECT_FLAGS_NO_NESTING),
     212                                                      RTTHREADSTATE_CRITSECT, false);
    213213            if (RT_FAILURE(rc9))
    214214            {
     
    217217            }
    218218#else
    219             RTThreadBlocking(hThreadSelf, RTTHREADSTATE_CRITSECT);
     219            RTThreadBlocking(hThreadSelf, RTTHREADSTATE_CRITSECT, false);
    220220#endif
    221221            int rc = RTSemEventWait(pCritSect->EventSem, RT_INDEFINITE_WAIT);
  • trunk/src/VBox/Runtime/generic/semrw-generic.cpp

    r25620 r25638  
    136136#ifdef RTSEMRW_STRICT
    137137                        RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis);
    138                         RTLockValidatorRecSharedInit(&pThis->ValidatorRead,  NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis);
     138                        RTLockValidatorRecSharedInit(&pThis->ValidatorRead,  NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/);
    139139                        RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core);
    140140#endif
     
    272272        Assert(pThis->cReads > 0);
    273273#ifdef RTSEMRW_STRICT
    274         RTLockValidatorSharedRecAddOwner(&pThis->ValidatorRead, hThreadSelf, pSrcPos);
     274        RTLockValidatorRecSharedAddOwner(&pThis->ValidatorRead, hThreadSelf, pSrcPos);
    275275#endif
    276276
     
    324324        }
    325325#ifdef RTSEMRW_STRICT
    326         rc = RTLockValidatorRecSharedCheckBlocking(&pThis->ValidatorRead, hThreadSelf, pSrcPos, true, RTTHREADSTATE_RW_READ);
     326        rc = RTLockValidatorRecSharedCheckBlocking(&pThis->ValidatorRead, hThreadSelf, pSrcPos, true,
     327                                                   RTTHREADSTATE_RW_READ, false);
    327328        if (RT_FAILURE(rc))
    328329            break;
    329330#else
    330         RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_READ);
     331        RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_READ, false);
    331332#endif
    332333        int rcWait;
     
    368369            Assert(pThis->cReads > 0);
    369370#ifdef RTSEMRW_STRICT
    370             RTLockValidatorSharedRecAddOwner(&pThis->ValidatorRead, hThreadSelf, pSrcPos);
     371            RTLockValidatorRecSharedAddOwner(&pThis->ValidatorRead, hThreadSelf, pSrcPos);
    371372#endif
    372373
     
    612613
    613614#ifdef RTSEMRW_STRICT
    614         rc = RTLockValidatorRecExclCheckBlocking(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true, RTTHREADSTATE_RW_WRITE);
     615        rc = RTLockValidatorRecExclCheckBlocking(&pThis->ValidatorWrite, hThreadSelf, pSrcPos, true,
     616                                                 RTTHREADSTATE_RW_WRITE, false);
    615617        if (RT_FAILURE(rc))
    616618            break;
    617619#else
    618         RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_WRITE);
     620        RTThreadBlocking(hThreadSelf, RTTHREADSTATE_RW_WRITE, false);
    619621#endif
    620622        int rcWait;
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