VirtualBox

Changeset 38944 in vbox


Ignore:
Timestamp:
Oct 5, 2011 2:03:53 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74310
Message:

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

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/vmm/pdmcritsect.h

    r37582 r38944  
    5858VMMDECL(int)        PDMCritSectTryEnterDebug(PPDMCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL);
    5959VMMR3DECL(int)      PDMR3CritSectEnterEx(PPDMCRITSECT pCritSect, bool fCallRing3);
    60 VMMDECL(void)       PDMCritSectLeave(PPDMCRITSECT pCritSect);
     60VMMDECL(int)        PDMCritSectLeave(PPDMCRITSECT pCritSect);
    6161VMMDECL(bool)       PDMCritSectIsOwner(PCPDMCRITSECT pCritSect);
    6262VMMDECL(bool)       PDMCritSectIsOwnerEx(PCPDMCRITSECT pCritSect, PVMCPU pVCpu);
  • trunk/include/iprt/err.h

    r38606 r38944  
    11061106/** Nested ownership requests are not permitted for this semaphore type. */
    11071107#define VERR_SEM_NESTED                     (-364)
     1108/** The release call only release a semaphore nesting, i.e. the caller is still
     1109 * holding the semaphore. */
     1110#define VINF_SEM_NESTED                     (364)
    11081111/** Deadlock detected. */
    11091112#define VERR_DEADLOCK                       (-365)
  • 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