VirtualBox

Changeset 30328 in vbox


Ignore:
Timestamp:
Jun 21, 2010 12:55:14 PM (15 years ago)
Author:
vboxsync
Message:

More paranoia

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp

    r30325 r30328  
    9191
    9292    ASMAtomicWriteS32(&pCritSect->s.Core.cNestings, 1);
     93    Assert(pCritSect->s.Core.cNestings == 1);
    9394    ASMAtomicWriteHandle(&pCritSect->s.Core.NativeThreadOwner, hNativeSelf);
    9495
     
    171172{
    172173    Assert(pCritSect->s.Core.cNestings < 8);  /* useful to catch incorrect locking */
     174    Assert(pCritSect->s.Core.cNestings >= 0);
    173175
    174176    /*
     
    192194        ASMAtomicIncS32(&pCritSect->s.Core.cLockers);
    193195        ASMAtomicIncS32(&pCritSect->s.Core.cNestings);
     196        Assert(pCritSect->s.Core.cNestings > 1);
    194197        ASMAtomicAndU32(&pCritSect->s.Core.fFlags, ~PDMCRITSECT_FLAGS_PENDING_UNLOCK);
    195198        return VINF_SUCCESS;
     
    313316        ASMAtomicIncS32(&pCritSect->s.Core.cLockers);
    314317        ASMAtomicIncS32(&pCritSect->s.Core.cNestings);
     318        Assert(pCritSect->s.Core.cNestings > 1);
    315319        ASMAtomicAndU32(&pCritSect->s.Core.fFlags, ~PDMCRITSECT_FLAGS_PENDING_UNLOCK);
    316320        return VINF_SUCCESS;
     
    423427    {
    424428        ASMAtomicDecS32(&pCritSect->s.Core.cNestings);
     429        Assert(pCritSect->s.Core.cNestings >= 1);
    425430        ASMAtomicDecS32(&pCritSect->s.Core.cLockers);
    426431        return;
     
    452457        ASMAtomicWriteHandle(&pCritSect->s.Core.NativeThreadOwner, NIL_RTNATIVETHREAD);
    453458        ASMAtomicDecS32(&pCritSect->s.Core.cNestings);
     459        Assert(pCritSect->s.Core.cNestings == 0);
    454460
    455461        /* stop and decrement lockers. */
     
    502508            ASMAtomicWriteHandle(&pCritSect->s.Core.NativeThreadOwner, hNativeThread);
    503509            STAM_PROFILE_ADV_START(&pCritSect->s.StatLocked, l);
     510            Assert(pCritSect->s.Core.cNestings == 0);
    504511            ASMAtomicWriteS32(&pCritSect->s.Core.cNestings, 1);
    505512        }
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