Lines Matching refs:pClass
270 static void rtLockValidatorClassDestroy(RTLOCKVALCLASSINT *pClass);
423 * @param pClass The class to complain about.
428 static void rtLockValComplainAboutClass(const char *pszPrefix, RTLOCKVALCLASSINT *pClass, uint32_t uSubClass, bool fVerbose)
453 if (!VALID_PTR(pClass))
455 RTAssertMsg2AddWeak("%sbad class=%p sub-class=%s\n", pszPrefix, pClass, pszSubClass);
458 if (pClass->u32Magic != RTLOCKVALCLASS_MAGIC)
460 RTAssertMsg2AddWeak("%sbad class=%p magic=%#x sub-class=%s\n", pszPrefix, pClass, pClass->u32Magic, pszSubClass);
466 pClass,
467 pClass->pszName,
468 pClass->CreatePos.pszFile,
469 pClass->CreatePos.uLine,
470 pClass->CreatePos.pszFunction,
471 pClass->CreatePos.uId,
477 for (PRTLOCKVALCLASSREFCHUNK pChunk = &pClass->PriorLocks; pChunk; pChunk = pChunk->pNext)
500 RTAssertMsg2AddWeak("%sHash Stats: %u hits, %u misses\n", pszPrefix, pClass->cHashHits, pClass->cHashMisses);
506 for (PRTLOCKVALCLASSREFCHUNK pChunk = &pClass->PriorLocks; pChunk; pChunk = pChunk->pNext)
535 * @param pClass The class.
537 static const char *rtLockValComplainGetClassName(RTLOCKVALCLASSINT *pClass)
539 if (!pClass)
541 if (!VALID_PTR(pClass))
543 if (pClass->u32Magic != RTLOCKVALCLASS_MAGIC)
545 if (!pClass->pszName)
547 return pClass->pszName;
1138 RTLOCKVALCLASSINT *pClass;
1141 int rc = RTLockValidatorClassCreateExV(&pClass, &SrcPos,
1148 ASMAtomicWriteBool(&pClass->fDonateRefToNextRetainer, true); /* see rtLockValidatorClassRetain */
1149 return pClass;
1156 * @param pClass The class.
1158 DECL_FORCE_INLINE(uint32_t) rtLockValidatorClassRetain(RTLOCKVALCLASSINT *pClass)
1160 uint32_t cRefs = ASMAtomicIncU32(&pClass->cRefs);
1162 ASMAtomicWriteU32(&pClass->cRefs, RTLOCKVALCLASS_MAX_REFS);
1164 && ASMAtomicXchgBool(&pClass->fDonateRefToNextRetainer, false))
1165 cRefs = ASMAtomicDecU32(&pClass->cRefs);
1190 * @param pClass The class.
1192 DECLINLINE(uint32_t) rtLockValidatorClassRelease(RTLOCKVALCLASSINT *pClass)
1194 uint32_t cRefs = ASMAtomicDecU32(&pClass->cRefs);
1196 ASMAtomicWriteU32(&pClass->cRefs, RTLOCKVALCLASS_MAX_REFS);
1198 rtLockValidatorClassDestroy(pClass);
1208 static void rtLockValidatorClassDestroy(RTLOCKVALCLASSINT *pClass)
1210 AssertReturnVoid(!pClass->fInTree);
1211 ASMAtomicWriteU32(&pClass->u32Magic, RTLOCKVALCLASS_MAGIC_DEAD);
1213 PRTLOCKVALCLASSREFCHUNK pChunk = &pClass->PriorLocks;
1228 if (pChunk != &pClass->PriorLocks)
1233 RTMemFree(pClass);
1244 RTLOCKVALCLASSINT *pClass = (RTLOCKVALCLASSINT *)RTAvllU32Get(&g_LockValClassTree, uSrcPosHash);
1245 while (pClass)
1247 if (rtLockValidatorSrcPosCompare(&pClass->CreatePos, pSrcPos) == 0)
1249 pClass = (RTLOCKVALCLASSINT *)pClass->Core.pList;
1254 return pClass;
1295 RTLOCKVALCLASSINT *pClass = hClass;
1296 AssertPtrReturn(pClass, UINT32_MAX);
1297 AssertReturn(pClass->u32Magic == RTLOCKVALCLASS_MAGIC, UINT32_MAX);
1298 return rtLockValidatorClassRetain(pClass);
1304 RTLOCKVALCLASSINT *pClass = hClass;
1305 if (pClass == NIL_RTLOCKVALCLASS)
1307 AssertPtrReturn(pClass, UINT32_MAX);
1308 AssertReturn(pClass->u32Magic == RTLOCKVALCLASS_MAGIC, UINT32_MAX);
1309 return rtLockValidatorClassRelease(pClass);
1318 * @param pClass The class to search.
1321 static bool rtLockValidatorClassIsPriorClassByLinearSearch(RTLOCKVALCLASSINT *pClass, RTLOCKVALCLASSINT *pPriorClass)
1323 for (PRTLOCKVALCLASSREFCHUNK pChunk = &pClass->PriorLocks; pChunk; pChunk = pChunk->pNext)
1336 PRTLOCKVALCLASSREF *ppHashEntry = &pClass->apPriorLocksHash[RTLOCKVALCLASS_HASH(pPriorClass)];
1342 ASMAtomicIncU32(&pClass->cHashMisses);
1356 * @param pClass The class to search.
1359 DECL_FORCE_INLINE(bool) rtLockValidatorClassIsPriorClass(RTLOCKVALCLASSINT *pClass, RTLOCKVALCLASSINT *pPriorClass)
1364 PRTLOCKVALCLASSREF pRef = pClass->apPriorLocksHash[RTLOCKVALCLASS_HASH(pPriorClass)];
1372 ASMAtomicIncU32(&pClass->cHashHits);
1377 return rtLockValidatorClassIsPriorClassByLinearSearch(pClass, pPriorClass);
1385 * @param pClass The class to work on.
1391 static int rtLockValidatorClassAddPriorClass(RTLOCKVALCLASSINT *pClass, RTLOCKVALCLASSINT *pPriorClass,
1403 if (!rtLockValidatorClassIsPriorClass(pPriorClass, pClass))
1405 if (!rtLockValidatorClassIsPriorClass(pClass, pPriorClass))
1410 for (PRTLOCKVALCLASSREFCHUNK pChunk = &pClass->PriorLocks; ; pChunk = pChunk->pNext)
1471 RTLOCKVALCLASSINT *pClass = hClass;
1472 AssertPtrReturn(pClass, VERR_INVALID_HANDLE);
1473 AssertReturn(pClass->u32Magic == RTLOCKVALCLASS_MAGIC, VERR_INVALID_HANDLE);
1479 return rtLockValidatorClassAddPriorClass(pClass, pPriorClass, false /*fAutodidacticism*/, NULL);
1485 RTLOCKVALCLASSINT *pClass = hClass;
1486 AssertPtrReturn(pClass, VERR_INVALID_HANDLE);
1487 AssertReturn(pClass->u32Magic == RTLOCKVALCLASS_MAGIC, VERR_INVALID_HANDLE);
1489 ASMAtomicWriteBool(&pClass->fStrictReleaseOrder, fEnabled);
2204 * @param pClass The lock class.
2210 static int rtLockValidatorStackCheckLockingOrder2(RTLOCKVALCLASSINT * const pClass, uint32_t const uSubClass,
2220 if ( pClass == pFirstBadClass
2221 || rtLockValidatorClassIsPriorClass(pFirstBadClass, pClass))
2223 pRec, pFirstBadRec, pClass, pFirstBadClass);
2224 if (!pClass->fAutodidact)
2226 pRec, pFirstBadRec, pClass, pFirstBadClass);
2249 if (!rtLockValidatorIsClassOrderOk(pClass, uSubClass, pPriorClass, uPriorSubClass))
2251 if ( pClass == pPriorClass
2252 || rtLockValidatorClassIsPriorClass(pPriorClass, pClass))
2254 pRec, pCur, pClass, pPriorClass);
2268 int rc = rtLockValidatorClassAddPriorClass(pClass, pFirstBadClass, true /*fAutodidacticism*/, pSrcPos);
2271 pRec, pFirstBadRec, pClass, pFirstBadClass);
2299 if (!rtLockValidatorIsClassOrderOk(pClass, uSubClass, pPriorClass, uPriorSubClass))
2301 if ( pClass == pPriorClass
2302 || rtLockValidatorClassIsPriorClass(pPriorClass, pClass))
2307 pRec, pCur, pClass, pPriorClass);
2328 if (!rtLockValidatorIsClassOrderOk(pClass, uSubClass, pPriorClass, uPriorSubClass))
2330 Assert( pClass != pPriorClass
2331 && !rtLockValidatorClassIsPriorClass(pPriorClass, pClass));
2332 int rc = rtLockValidatorClassAddPriorClass(pClass, pPriorClass, true /*fAutodidacticism*/, pSrcPos);
2338 Assert(rtLockValidatorClassIsPriorClass(pClass, pPriorClass));
2358 * @param pClass The lock class.
2364 static int rtLockValidatorStackCheckLockingOrder(RTLOCKVALCLASSINT * const pClass, uint32_t const uSubClass,
2371 AssertPtr(pClass);
2372 Assert(pClass->u32Magic == RTLOCKVALCLASS_MAGIC);
2400 if (RT_UNLIKELY(!rtLockValidatorIsClassOrderOk(pClass, uSubClass, pPriorClass, uPriorSubClass)))
2401 return rtLockValidatorStackCheckLockingOrder2(pClass, uSubClass, pThreadSelf, pRec, pSrcPos,