VirtualBox

Changeset 38944 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Oct 5, 2011 2:03:53 PM (13 years ago)
Author:
vboxsync
Message:

PDMCritSectLeave: Indicate whether it was a nested exit or a real one.

File:
1 edited

Legend:

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

    r38081 r38944  
    491491 * Leaves a critical section entered with PDMCritSectEnter().
    492492 *
     493 * @returns Indication whether we really exited the critical section.
     494 * @retval  VINF_SUCCESS if we really exited.
     495 * @retval  VINF_SEM_NESTED if we only reduced the nesting count.
     496 * @retval  VERR_NOT_OWNER if you somehow ignore release assertions.
     497 *
    493498 * @param   pCritSect           The PDM critical section to leave.
    494499 */
    495 VMMDECL(void) PDMCritSectLeave(PPDMCRITSECT pCritSect)
     500VMMDECL(int) PDMCritSectLeave(PPDMCRITSECT pCritSect)
    496501{
    497502    AssertMsg(pCritSect->s.Core.u32Magic == RTCRITSECT_MAGIC, ("%p %RX32\n", pCritSect, pCritSect->s.Core.u32Magic));
     
    500505    /* Check for NOP sections before asserting ownership. */
    501506    if (pCritSect->s.Core.fFlags & RTCRITSECT_FLAGS_NOP)
    502         return;
     507        return VINF_SUCCESS;
    503508
    504509    /*
     
    506511     */
    507512    RTNATIVETHREAD const hNativeSelf = pdmCritSectGetNativeSelf(pCritSect);
    508     AssertReleaseMsgReturnVoid(pCritSect->s.Core.NativeThreadOwner == hNativeSelf,
    509                                ("%p %s: %p != %p; cLockers=%d cNestings=%d\n", pCritSect, R3STRING(pCritSect->s.pszName),
    510                                 pCritSect->s.Core.NativeThreadOwner, hNativeSelf,
    511                                 pCritSect->s.Core.cLockers, pCritSect->s.Core.cNestings));
     513    AssertReleaseMsgReturn(pCritSect->s.Core.NativeThreadOwner == hNativeSelf,
     514                           ("%p %s: %p != %p; cLockers=%d cNestings=%d\n", pCritSect, R3STRING(pCritSect->s.pszName),
     515                            pCritSect->s.Core.NativeThreadOwner, hNativeSelf,
     516                            pCritSect->s.Core.cLockers, pCritSect->s.Core.cNestings),
     517                           VERR_NOT_OWNER);
    512518    Assert(pCritSect->s.Core.cNestings >= 1);
    513519
     
    521527        ASMAtomicDecS32(&pCritSect->s.Core.cLockers);
    522528        Assert(pCritSect->s.Core.cLockers >= 0);
    523         return;
     529        return VINF_SEM_NESTED;
    524530    }
    525531
     
    595601            ASMAtomicWriteHandle(&pCritSect->s.Core.NativeThreadOwner, NIL_RTNATIVETHREAD);
    596602            if (ASMAtomicCmpXchgS32(&pCritSect->s.Core.cLockers, -1, 0))
    597                 return;
     603                return VINF_SUCCESS;
    598604
    599605            /* darn, someone raced in on us. */
     
    620626    }
    621627#endif /* IN_RING0 || IN_RC */
     628
     629    return VINF_SUCCESS;
    622630}
    623631
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