Changeset 25368 in vbox for trunk/src/VBox/VMM/PDMCritSect.cpp
- Timestamp:
- Dec 14, 2009 4:31:40 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/VMM/PDMCritSect.cpp
r23350 r25368 126 126 if (RT_SUCCESS(rc)) 127 127 { 128 /* 129 * Initialize the structure (first bit is c&p from RTCritSectInitEx). 130 */ 131 pCritSect->Core.u32Magic = RTCRITSECT_MAGIC; 132 pCritSect->Core.fFlags = 0; 133 pCritSect->Core.cNestings = 0; 134 pCritSect->Core.cLockers = -1; 135 pCritSect->Core.NativeThreadOwner = NIL_RTNATIVETHREAD; 136 pCritSect->Core.Strict.ThreadOwner = NIL_RTTHREAD; 137 pCritSect->Core.Strict.pszEnterFile = NULL; 138 pCritSect->Core.Strict.u32EnterLine = 0; 139 pCritSect->Core.Strict.uEnterId = 0; 140 pCritSect->pVMR3 = pVM; 141 pCritSect->pVMR0 = pVM->pVMR0; 142 pCritSect->pVMRC = pVM->pVMRC; 143 pCritSect->pvKey = pvKey; 144 pCritSect->EventToSignal = NIL_RTSEMEVENT; 145 pCritSect->pNext = pVM->pdm.s.pCritSects; 146 pCritSect->pszName = RTStrDup(pszName); 147 pVM->pdm.s.pCritSects = pCritSect; 148 STAMR3RegisterF(pVM, &pCritSect->StatContentionRZLock, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PDM/CritSects/%s/ContentionRZLock", pszName); 149 STAMR3RegisterF(pVM, &pCritSect->StatContentionRZUnlock,STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PDM/CritSects/%s/ContentionRZUnlock", pszName); 150 STAMR3RegisterF(pVM, &pCritSect->StatContentionR3, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PDM/CritSects/%s/ContentionR3", pszName); 128 rc = RTLockValidatorCreate(&pCritSect->Core.pValidatorRec, NIL_RTLOCKVALIDATORCLASS, 0, pszName, pCritSect); 129 if (RT_SUCCESS(rc)) 130 { 131 /* 132 * Initialize the structure (first bit is c&p from RTCritSectInitEx). 133 */ 134 pCritSect->Core.u32Magic = RTCRITSECT_MAGIC; 135 pCritSect->Core.fFlags = 0; 136 pCritSect->Core.cNestings = 0; 137 pCritSect->Core.cLockers = -1; 138 pCritSect->Core.NativeThreadOwner = NIL_RTNATIVETHREAD; 139 pCritSect->pVMR3 = pVM; 140 pCritSect->pVMR0 = pVM->pVMR0; 141 pCritSect->pVMRC = pVM->pVMRC; 142 pCritSect->pvKey = pvKey; 143 pCritSect->EventToSignal = NIL_RTSEMEVENT; 144 pCritSect->pNext = pVM->pdm.s.pCritSects; 145 pCritSect->pszName = RTStrDup(pszName); 146 pVM->pdm.s.pCritSects = pCritSect; 147 STAMR3RegisterF(pVM, &pCritSect->StatContentionRZLock, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PDM/CritSects/%s/ContentionRZLock", pszName); 148 STAMR3RegisterF(pVM, &pCritSect->StatContentionRZUnlock,STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PDM/CritSects/%s/ContentionRZUnlock", pszName); 149 STAMR3RegisterF(pVM, &pCritSect->StatContentionR3, STAMTYPE_COUNTER, STAMVISIBILITY_ALWAYS, STAMUNIT_OCCURENCES, NULL, "/PDM/CritSects/%s/ContentionR3", pszName); 151 150 #ifdef VBOX_WITH_STATISTICS 152 STAMR3RegisterF(pVM, &pCritSect->StatLocked, STAMTYPE_PROFILE_ADV, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, NULL, "/PDM/CritSects/%s/Locked", pszName);151 STAMR3RegisterF(pVM, &pCritSect->StatLocked, STAMTYPE_PROFILE_ADV, STAMVISIBILITY_ALWAYS, STAMUNIT_TICKS_PER_OCCURENCE, NULL, "/PDM/CritSects/%s/Locked", pszName); 153 152 #endif 153 return VINF_SUCCESS; 154 } 155 156 SUPSemEventClose(pVM->pSession, (SUPSEMEVENT)pCritSect->Core.EventSem); 154 157 } 155 158 return rc; … … 241 244 int rc = SUPSemEventClose(pVM->pSession, hEvent); 242 245 AssertRC(rc); 246 RTLockValidatorDestroy(&pCritSect->Core.pValidatorRec); 243 247 pCritSect->pNext = NULL; 244 248 pCritSect->pvKey = NULL; … … 390 394 return false; 391 395 396 #ifdef PDMCRITSECT_STRICT 397 const char * const pszFile = pCritSect->s.Core.pValidatorRec->pszFile; 398 const char * const pszFunction = pCritSect->s.Core.pValidatorRec->pszFunction; 399 uint32_t const iLine = pCritSect->s.Core.pValidatorRec->uLine; 400 RTHCUINTPTR const uId = pCritSect->s.Core.pValidatorRec->uId; 401 #endif 392 402 PDMCritSectLeave(pCritSect); 393 403 … … 411 421 } 412 422 423 #ifdef PDMCRITSECT_STRICT 424 int rc = PDMCritSectEnterDebug(pCritSect, VERR_INTERNAL_ERROR, uId, pszFile, iLine, pszFunction); 425 #else 413 426 int rc = PDMCritSectEnter(pCritSect, VERR_INTERNAL_ERROR); 427 #endif 414 428 AssertLogRelRC(rc); 415 429 return true;
Note:
See TracChangeset
for help on using the changeset viewer.