VirtualBox

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


Ignore:
Timestamp:
Jan 10, 2010 8:12:30 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56439
Message:

iprt,pdmcritsect: More flexible lock naming, added RTCritSectSetSubClass and made some RTCritSectInitEx.

Location:
trunk/src/VBox/Runtime/generic
Files:
3 edited

Legend:

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

    r25685 r25704  
    5353
    5454
    55 RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszName)
     55RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags, RTLOCKVALCLASS hClass, uint32_t uSubClass,
     56                             const char *pszNameFmt, ...)
    5657{
    5758    AssertReturn(fFlags <= (RTCRITSECT_FLAGS_NO_NESTING | RTCRITSECT_FLAGS_NO_LOCK_VAL), VERR_INVALID_PARAMETER);
     
    6566    pCritSect->cLockers             = -1;
    6667    pCritSect->NativeThreadOwner    = NIL_RTNATIVETHREAD;
    67     int rc = RTLockValidatorRecExclCreate(&pCritSect->pValidatorRec, hClass, uSubClass, pszName,
    68                                           pCritSect, !(fFlags & RTCRITSECT_FLAGS_NO_LOCK_VAL));
     68#ifndef RTCRITSECT_STRICT
     69    pCritSect->pValidatorRec        = NULL;
     70    int rc = VINF_SUCCESS;
     71#else
     72    va_list va;
     73    va_start(va, pszNameFmt);
     74    int rc = RTLockValidatorRecExclCreateV(&pCritSect->pValidatorRec, hClass, uSubClass, pCritSect,
     75                                           !(fFlags & RTCRITSECT_FLAGS_NO_LOCK_VAL), pszNameFmt, va);
     76    va_end(va);
     77#endif
    6978    if (RT_SUCCESS(rc))
    7079    {
     
    8190}
    8291RT_EXPORT_SYMBOL(RTCritSectInitEx);
     92
     93
     94RTDECL(uint32_t) RTCritSectSetSubClass(PRTCRITSECT pCritSect, uint32_t uSubClass)
     95{
     96#ifdef RTCRITSECT_STRICT
     97    AssertPtrReturn(pCritSect, RTLOCKVAL_SUB_CLASS_INVALID);
     98    AssertReturn(pCritSect->u32Magic == RTCRITSECT_MAGIC, RTLOCKVAL_SUB_CLASS_INVALID);
     99    return RTLockValidatorRecExclSetSubClass(pCritSect->pValidatorRec, uSubClass);
     100#else
     101    return RTLOCKVAL_SUB_CLASS_INVALID;
     102#endif
     103}
    83104
    84105
  • trunk/src/VBox/Runtime/generic/semrw-generic.cpp

    r25685 r25704  
    135135                        pThis->u32Magic             = RTSEMRW_MAGIC;
    136136#ifdef RTSEMRW_STRICT
    137                         RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, true);
    138                         RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/, true);
     137                        RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis,
     138                                                   true /*fEnabled*/, "RTSemRW");
     139                        RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis,
     140                                                     false /*fSignaller*/, true /*fEnabled*/, "RTSemEvent");
    139141                        RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core);
    140142#endif
  • trunk/src/VBox/Runtime/generic/semrw-lockless-generic.cpp

    r25685 r25704  
    134134            pThis->fNeedReset           = false;
    135135#ifdef RTSEMRW_STRICT
    136             RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, true);
    137             RTLockValidatorRecSharedInit(&pThis->ValidatorRead,  NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, "RTSemRW", pThis, false /*fSignaller*/, true);
     136            RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis,
     137                                       true /*fEnabled*/, "RTSemRW");
     138            RTLockValidatorRecSharedInit(&pThis->ValidatorRead,  NIL_RTLOCKVALCLASS, RTLOCKVAL_SUB_CLASS_NONE, pThis,
     139                                         false /*fSignaller*/, true /*fEnabled*/, "RTSemEvent");
    138140            RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core);
    139141#endif
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