Changeset 25607 in vbox
- Timestamp:
- Dec 31, 2009 1:21:39 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56298
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/critsect.h
r25406 r25607 87 87 RTSEMEVENT EventSem; 88 88 /** Lock validator record. Only used in strict builds. */ 89 R3R0PTRTYPE(PRTLOCKVAL IDATORREC)pValidatorRec;89 R3R0PTRTYPE(PRTLOCKVALRECEXCL) pValidatorRec; 90 90 /** Alignmnet padding. */ 91 91 RTHCPTR Alignment; -
trunk/include/iprt/lockvalidator.h
r25602 r25607 46 46 /** Pointer to a record union. 47 47 * @internal */ 48 typedef union RTLOCKVAL IDATORRECUNION *PRTLOCKVALIDATORRECUNION;48 typedef union RTLOCKVALRECUNION *PRTLOCKVALRECUNION; 49 49 50 50 /** 51 51 * Source position. 52 52 */ 53 typedef struct RTLOCKVAL IDATORSRCPOS53 typedef struct RTLOCKVALSRCPOS 54 54 { 55 55 /** The file where the lock was taken. */ … … 64 64 uint32_t u32Padding; /**< Alignment padding. */ 65 65 #endif 66 } RTLOCKVAL IDATORSRCPOS;67 AssertCompileSize(RTLOCKVAL IDATORSRCPOS, HC_ARCH_BITS == 32 ? 16 : 32);66 } RTLOCKVALSRCPOS; 67 AssertCompileSize(RTLOCKVALSRCPOS, HC_ARCH_BITS == 32 ? 16 : 32); 68 68 /* The pointer types are defined in iprt/types.h. */ 69 69 70 /** @def RTLOCKVAL IDATORSRCPOS_INIT71 * Initializer for a RTLOCKVAL IDATORSRCPOS variable.70 /** @def RTLOCKVALSRCPOS_INIT 71 * Initializer for a RTLOCKVALSRCPOS variable. 72 72 * 73 73 * @param pszFile The file name. Optional (NULL). … … 78 78 */ 79 79 #if HC_ARCH_BITS == 64 80 # define RTLOCKVAL IDATORSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \80 # define RTLOCKVALSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \ 81 81 { (pszFile), (pszFunction), (uId), (uLine), 0 } 82 82 #else 83 # define RTLOCKVAL IDATORSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \83 # define RTLOCKVALSRCPOS_INIT(pszFile, uLine, pszFunction, uId) \ 84 84 { (pszFile), (pszFunction), (uId), (uLine) } 85 85 #endif 86 86 87 /** @def RTLOCKVAL IDATORSRCPOS_INIT_DEBUG_API88 * Initializer for a RTLOCKVAL IDATORSRCPOS variable in a typicial debug API87 /** @def RTLOCKVALSRCPOS_INIT_DEBUG_API 88 * Initializer for a RTLOCKVALSRCPOS variable in a typicial debug API 89 89 * variant. Assumes RT_SRC_POS_DECL and RTHCUINTPTR uId as arguments. 90 90 */ 91 #define RTLOCKVAL IDATORSRCPOS_INIT_DEBUG_API() \92 RTLOCKVAL IDATORSRCPOS_INIT(pszFile, iLine, pszFunction, uId)93 94 /** @def RTLOCKVAL IDATORSRCPOS_INIT_NORMAL_API95 * Initializer for a RTLOCKVAL IDATORSRCPOS variable in a normal API91 #define RTLOCKVALSRCPOS_INIT_DEBUG_API() \ 92 RTLOCKVALSRCPOS_INIT(pszFile, iLine, pszFunction, uId) 93 94 /** @def RTLOCKVALSRCPOS_INIT_NORMAL_API 95 * Initializer for a RTLOCKVALSRCPOS variable in a normal API 96 96 * variant. Assumes iprt/asm.h is included. 97 97 */ 98 #define RTLOCKVAL IDATORSRCPOS_INIT_NORMAL_API() \99 RTLOCKVAL IDATORSRCPOS_INIT(__FILE__, __LINE__, __PRETTY_FUNCTION__, (uintptr_t)ASMReturnAddress())98 #define RTLOCKVALSRCPOS_INIT_NORMAL_API() \ 99 RTLOCKVALSRCPOS_INIT(__FILE__, __LINE__, __PRETTY_FUNCTION__, (uintptr_t)ASMReturnAddress()) 100 100 101 101 /** Pointer to a record of one ownership share. */ 102 typedef struct RTLOCKVAL IDATORSHARED *PRTLOCKVALIDATORSHARED;102 typedef struct RTLOCKVALRECSHRD *PRTLOCKVALRECSHRD; 103 103 104 104 … … 110 110 /** The magic value indicating the record type. */ 111 111 uint32_t u32Magic; 112 } RTLOCKVAL IDATORRECCORE;112 } RTLOCKVALRECCORE; 113 113 /** Pointer to a lock validator record core. */ 114 typedef RTLOCKVAL IDATORRECCORE *PRTLOCKVALIDATORRECCORE;114 typedef RTLOCKVALRECCORE *PRTLOCKVALRECCORE; 115 115 /** Pointer to a const lock validator record core. */ 116 typedef RTLOCKVAL IDATORRECCORE const *PCRTLOCKVALIDATORRECCORE;117 118 119 /** 120 * Record recording the ownership of a lock.116 typedef RTLOCKVALRECCORE const *PCRTLOCKVALRECCORE; 117 118 119 /** 120 * Record recording the exclusive ownership of a lock. 121 121 * 122 122 * This is typically part of the per-lock data structure when compiling with 123 123 * the lock validator. 124 124 */ 125 typedef struct RTLOCKVAL IDATORREC125 typedef struct RTLOCKVALRECEXCL 126 126 { 127 /** Record core with RTLOCKVAL IDATORREC_MAGIC as the magic value. */128 RTLOCKVAL IDATORRECCORECore;127 /** Record core with RTLOCKVALRECEXCL_MAGIC as the magic value. */ 128 RTLOCKVALRECCORE Core; 129 129 /** Whether it's enabled or not. */ 130 130 bool fEnabled; … … 132 132 bool afReserved[3]; 133 133 /** Source position where the lock was taken. */ 134 RTLOCKVAL IDATORSRCPOSSrcPos;134 RTLOCKVALSRCPOS SrcPos; 135 135 /** The current owner thread. */ 136 136 RTTHREAD volatile hThread; 137 137 /** Pointer to the lock record below us. Only accessed by the owner. */ 138 R3R0PTRTYPE(PRTLOCKVAL IDATORREC)pDown;138 R3R0PTRTYPE(PRTLOCKVALRECUNION) pDown; 139 139 /** Recursion count */ 140 140 uint32_t cRecursion; … … 149 149 /** Pointer to the next sibling record. 150 150 * This is used to find the read side of a read-write lock. */ 151 R3R0PTRTYPE(PRTLOCKVAL IDATORRECUNION) pSibling;152 } RTLOCKVAL IDATORREC;153 AssertCompileSize(RTLOCKVAL IDATORREC, HC_ARCH_BITS == 32 ? 8 + 16 + 32 : 8 + 32 + 56);151 R3R0PTRTYPE(PRTLOCKVALRECUNION) pSibling; 152 } RTLOCKVALRECEXCL; 153 AssertCompileSize(RTLOCKVALRECEXCL, HC_ARCH_BITS == 32 ? 8 + 16 + 32 : 8 + 32 + 56); 154 154 /* The pointer type is defined in iprt/types.h. */ 155 155 … … 157 157 * For recording the one ownership share. 158 158 */ 159 typedef struct RTLOCKVAL IDATORSHAREDONE159 typedef struct RTLOCKVALRECSHRDOWN 160 160 { 161 /** Record core with RTLOCKVAL IDATORSHAREDONE_MAGIC as the magic value. */162 RTLOCKVAL IDATORRECCORECore;161 /** Record core with RTLOCKVALRECSHRDOWN_MAGIC as the magic value. */ 162 RTLOCKVALRECCORE Core; 163 163 /** Recursion count */ 164 164 uint32_t cRecursion; … … 166 166 RTTHREAD volatile hThread; 167 167 /** Pointer to the lock record below us. Only accessed by the owner. */ 168 R3R0PTRTYPE(PRTLOCKVAL IDATORREC)pDown;168 R3R0PTRTYPE(PRTLOCKVALRECUNION) pDown; 169 169 /** Pointer back to the shared record. */ 170 R3R0PTRTYPE(PRTLOCKVAL IDATORSHARED)pSharedRec;170 R3R0PTRTYPE(PRTLOCKVALRECSHRD) pSharedRec; 171 171 #if HC_ARCH_BITS == 32 172 172 /** Reserved. */ … … 174 174 #endif 175 175 /** Source position where the lock was taken. */ 176 RTLOCKVAL IDATORSRCPOSSrcPos;177 } RTLOCKVAL IDATORSHAREDONE;178 AssertCompileSize(RTLOCKVAL IDATORSHAREDONE, HC_ARCH_BITS == 32 ? 24 + 16 : 32 + 32);179 /** Pointer to a RTLOCKVAL IDATORSHAREDONE. */180 typedef RTLOCKVAL IDATORSHAREDONE *PRTLOCKVALIDATORSHAREDONE;176 RTLOCKVALSRCPOS SrcPos; 177 } RTLOCKVALRECSHRDOWN; 178 AssertCompileSize(RTLOCKVALRECSHRDOWN, HC_ARCH_BITS == 32 ? 24 + 16 : 32 + 32); 179 /** Pointer to a RTLOCKVALRECSHRDOWN. */ 180 typedef RTLOCKVALRECSHRDOWN *PRTLOCKVALRECSHRDOWN; 181 181 182 182 /** … … 186 186 * the lock validator. 187 187 */ 188 typedef struct RTLOCKVAL IDATORSHARED188 typedef struct RTLOCKVALRECSHRD 189 189 { 190 /** Record core with RTLOCKVAL IDATORSHARED_MAGIC as the magic value. */191 RTLOCKVAL IDATORRECCORECore;190 /** Record core with RTLOCKVALRECSHRD_MAGIC as the magic value. */ 191 RTLOCKVALRECCORE Core; 192 192 /** The lock sub-class. */ 193 193 uint32_t volatile uSubClass; … … 200 200 /** Pointer to the next sibling record. 201 201 * This is used to find the write side of a read-write lock. */ 202 R3R0PTRTYPE(PRTLOCKVAL IDATORRECUNION)pSibling;202 R3R0PTRTYPE(PRTLOCKVALRECUNION) pSibling; 203 203 204 204 /** The number of entries in the table. … … 219 219 bool afPadding[2]; 220 220 /** Pointer to a table containing pointers to records of all the owners. */ 221 R3R0PTRTYPE(PRTLOCKVAL IDATORSHAREDONEvolatile *) papOwners;221 R3R0PTRTYPE(PRTLOCKVALRECSHRDOWN volatile *) papOwners; 222 222 #if HC_ARCH_BITS == 32 223 223 /** Alignment padding. */ 224 224 uint32_t u32Alignment; 225 225 #endif 226 } RTLOCKVAL IDATORSHARED;227 AssertCompileSize(RTLOCKVAL IDATORSHARED, HC_ARCH_BITS == 32 ? 24 + 20 + 4 : 40 + 24);226 } RTLOCKVALRECSHRD; 227 AssertCompileSize(RTLOCKVALRECSHRD, HC_ARCH_BITS == 32 ? 24 + 20 + 4 : 40 + 24); 228 228 229 229 … … 244 244 * Initialize a lock validator record. 245 245 * 246 * Use RTLockValidatorRec Delete to deinitialize it.246 * Use RTLockValidatorRecExclDelete to deinitialize it. 247 247 * 248 248 * @param pRec The record. … … 255 255 * @param hLock The lock handle. 256 256 */ 257 RTDECL(void) RTLockValidatorRec Init(PRTLOCKVALIDATORRECpRec, RTLOCKVALIDATORCLASS hClass,258 uint32_t uSubClass, const char *pszName, void *hLock);257 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALIDATORCLASS hClass, 258 uint32_t uSubClass, const char *pszName, void *hLock); 259 259 /** 260 260 * Uninitialize a lock validator record previously initialized by … … 263 263 * @param pRec The record. Must be valid. 264 264 */ 265 RTDECL(void) RTLockValidatorRec Delete(PRTLOCKVALIDATORRECpRec);265 RTDECL(void) RTLockValidatorRecExclDelete(PRTLOCKVALRECEXCL pRec); 266 266 267 267 /** 268 268 * Create and initialize a lock validator record. 269 269 * 270 * Use RTLockValidatorRec Destroy to deinitialize and destroy the returned270 * Use RTLockValidatorRecExclDestroy to deinitialize and destroy the returned 271 271 * record. 272 272 * … … 281 281 * @param hLock The lock handle. 282 282 */ 283 RTDECL(int) RTLockValidatorRec Create(PRTLOCKVALIDATORREC*ppRec, RTLOCKVALIDATORCLASS hClass,284 uint32_t uSubClass, const char *pszName, void *hLock);285 286 /** 287 * Deinitialize and destroy a record created by RTLockValidatorRec Create.283 RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALIDATORCLASS hClass, 284 uint32_t uSubClass, const char *pszName, void *hLock); 285 286 /** 287 * Deinitialize and destroy a record created by RTLockValidatorRecExclCreate. 288 288 * 289 289 * @param ppRec Pointer to the record pointer. Will be set to 290 290 * NULL. 291 291 */ 292 RTDECL(void) RTLockValidatorRec Destroy(PRTLOCKVALIDATORREC*ppRec);292 RTDECL(void) RTLockValidatorRecExclDestroy(PRTLOCKVALRECEXCL *ppRec); 293 293 294 294 /** 295 295 * Initialize a lock validator record for a shared lock. 296 296 * 297 * Use RTLockValidator SharedRecDelete to deinitialize it.297 * Use RTLockValidatorRecSharedDelete to deinitialize it. 298 298 * 299 299 * @param pRec The shared lock record. … … 306 306 * @param hLock The lock handle. 307 307 */ 308 RTDECL(void) RTLockValidator SharedRecInit(PRTLOCKVALIDATORSHARED pRec, RTLOCKVALIDATORCLASS hClass,308 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALIDATORCLASS hClass, 309 309 uint32_t uSubClass, const char *pszName, void *hLock); 310 310 /** 311 311 * Uninitialize a lock validator record previously initialized by 312 * RTLockValidator SharedRecInit.312 * RTLockValidatorRecSharedInit. 313 313 * 314 314 * @param pRec The shared lock record. Must be valid. 315 315 */ 316 RTDECL(void) RTLockValidator SharedRecDelete(PRTLOCKVALIDATORSHARED pRec);316 RTDECL(void) RTLockValidatorRecSharedDelete(PRTLOCKVALRECSHRD pRec); 317 317 318 318 /** … … 324 324 * @param pRec2 Record 2. 325 325 */ 326 RTDECL(int) RTLockValidator MakeSiblings(PRTLOCKVALIDATORRECCORE pRec1, PRTLOCKVALIDATORRECCORE pRec2);326 RTDECL(int) RTLockValidatorRecMakeSiblings(PRTLOCKVALRECCORE pRec1, PRTLOCKVALRECCORE pRec2); 327 327 328 328 /** … … 342 342 * @param pSrcPos The source position of the lock operation. 343 343 */ 344 RTDECL(int) RTLockValidatorCheckOrder(PRTLOCKVAL IDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos);344 RTDECL(int) RTLockValidatorCheckOrder(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos); 345 345 346 346 /** … … 361 361 * @param pSrcPos The source position of the lock operation. 362 362 */ 363 RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVAL IDATORRECpRec, RTTHREAD hThread,363 RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread, 364 364 RTTHREADSTATE enmState, bool fRecursiveOk, 365 PCRTLOCKVAL IDATORSRCPOS pSrcPos);365 PCRTLOCKVALSRCPOS pSrcPos); 366 366 367 367 /** … … 384 384 * @param pSrcPos The source position of the lock operation. 385 385 */ 386 RTDECL(int) RTLockValidatorCheckWriteOrderBlocking(PRTLOCKVAL IDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead,386 RTDECL(int) RTLockValidatorCheckWriteOrderBlocking(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead, 387 387 RTTHREAD hThread, RTTHREADSTATE enmState, bool fRecursiveOk, 388 PCRTLOCKVAL IDATORSRCPOS pSrcPos);388 PCRTLOCKVALSRCPOS pSrcPos); 389 389 390 390 /** … … 407 407 * @param pSrcPos The source position of the lock operation. 408 408 */ 409 RTDECL(int) RTLockValidatorCheckReadOrderBlocking(PRTLOCKVAL IDATORSHARED pRead, PRTLOCKVALIDATORRECpWrite,409 RTDECL(int) RTLockValidatorCheckReadOrderBlocking(PRTLOCKVALRECSHRD pRead, PRTLOCKVALRECEXCL pWrite, 410 410 RTTHREAD hThread, RTTHREADSTATE enmState, bool fRecursiveOk, 411 PCRTLOCKVAL IDATORSRCPOS pSrcPos);411 PCRTLOCKVALSRCPOS pSrcPos); 412 412 413 413 /** … … 423 423 * @param pRec The validator record. 424 424 */ 425 RTDECL(int) RTLockValidatorCheckAndRelease(PRTLOCKVAL IDATORRECpRec);425 RTDECL(int) RTLockValidatorCheckAndRelease(PRTLOCKVALRECEXCL pRec); 426 426 427 427 /** … … 438 438 * @param hThread The handle of the calling thread. 439 439 */ 440 RTDECL(int) RTLockValidatorCheckAndReleaseReadOwner(PRTLOCKVAL IDATORSHARED pRead, RTTHREAD hThread);440 RTDECL(int) RTLockValidatorCheckAndReleaseReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread); 441 441 442 442 /** … … 453 453 * @param pSrcPos The source position of the lock operation. 454 454 */ 455 RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVAL IDATORREC pRec, PCRTLOCKVALIDATORSRCPOS pSrcPos);455 RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALRECEXCL pRec, PCRTLOCKVALSRCPOS pSrcPos); 456 456 457 457 /** … … 467 467 * @param pRec The validator record. 468 468 */ 469 RTDECL(int) RTLockValidatorUnwindRecursion(PRTLOCKVAL IDATORRECpRec);469 RTDECL(int) RTLockValidatorUnwindRecursion(PRTLOCKVALRECEXCL pRec); 470 470 471 471 /** … … 485 485 * @param pWrite The validator record for the writer. 486 486 */ 487 RTDECL(int) RTLockValidatorRecordReadWriteRecursion(PRTLOCKVAL IDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead, PCRTLOCKVALIDATORSRCPOS pSrcPos);487 RTDECL(int) RTLockValidatorRecordReadWriteRecursion(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead, PCRTLOCKVALSRCPOS pSrcPos); 488 488 489 489 /** … … 501 501 * @param pWrite The validator record for the writer. 502 502 */ 503 RTDECL(int) RTLockValidatorUnwindReadWriteRecursion(PRTLOCKVAL IDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead);503 RTDECL(int) RTLockValidatorUnwindReadWriteRecursion(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead); 504 504 505 505 /** … … 517 517 * @param pSrcPos The source position of the lock operation. 518 518 */ 519 RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVAL IDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos);519 RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos); 520 520 521 521 /** … … 528 528 * @param pRec The validator record. 529 529 */ 530 RTDECL(RTTHREAD) RTLockValidatorUnsetOwner(PRTLOCKVAL IDATORRECpRec);530 RTDECL(RTTHREAD) RTLockValidatorUnsetOwner(PRTLOCKVALRECEXCL pRec); 531 531 532 532 /** … … 540 540 * @param pSrcPos The source position of the lock operation. 541 541 */ 542 RTDECL(void) RTLockValidatorAddReadOwner(PRTLOCKVAL IDATORSHARED pRead, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos);542 RTDECL(void) RTLockValidatorAddReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos); 543 543 544 544 /** … … 551 551 * @param hThread The thread to to remove. 552 552 */ 553 RTDECL(void) RTLockValidatorRemoveReadOwner(PRTLOCKVAL IDATORSHARED pRead, RTTHREAD hThread);553 RTDECL(void) RTLockValidatorRemoveReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread); 554 554 555 555 /** -
trunk/include/iprt/types.h
r25591 r25607 1479 1479 /** Pointer to a lock validator record. 1480 1480 * The structure definition is found in iprt/lockvalidator.h. */ 1481 typedef struct RTLOCKVAL IDATORREC *PRTLOCKVALIDATORREC;1481 typedef struct RTLOCKVALRECEXCL *PRTLOCKVALRECEXCL; 1482 1482 /** Pointer to a lock validator source poisition. 1483 1483 * The structure definition is found in iprt/lockvalidator.h. */ 1484 typedef struct RTLOCKVAL IDATORSRCPOS *PRTLOCKVALIDATORSRCPOS;1484 typedef struct RTLOCKVALSRCPOS *PRTLOCKVALSRCPOS; 1485 1485 /** Pointer to a const lock validator source poisition. 1486 1486 * The structure definition is found in iprt/lockvalidator.h. */ 1487 typedef struct RTLOCKVAL IDATORSRCPOS const *PCRTLOCKVALIDATORSRCPOS;1487 typedef struct RTLOCKVALSRCPOS const *PCRTLOCKVALSRCPOS; 1488 1488 1489 1489 -
trunk/src/VBox/Runtime/common/misc/lockvalidator.cpp
r25604 r25607 58 58 { 59 59 /** The current record. */ 60 PRTLOCKVAL IDATORRECUNION pRec;60 PRTLOCKVALRECUNION pRec; 61 61 /** The current entry number if pRec is a shared one. */ 62 62 uint32_t iEntry; … … 70 70 * siblings. This is used for validating a deadlock stack as well as 71 71 * terminating the sibling walk. */ 72 PRTLOCKVAL IDATORRECUNION pFirstSibling;72 PRTLOCKVALRECUNION pFirstSibling; 73 73 } RTLOCKVALIDATORDDENTRY; 74 74 … … 92 92 *******************************************************************************/ 93 93 /** Serializing object destruction and deadlock detection. 94 * NS: RTLOCKVALIDATORREC and RTTHREADINT destruction.94 * NS: RTLOCKVALIDATORREC* and RTTHREADINT destruction. 95 95 * EW: Deadlock detection. 96 96 */ … … 114 114 115 115 /** Wrapper around ASMAtomicReadPtr. */ 116 DECL_FORCE_INLINE(PRTLOCKVAL IDATORRECUNION) rtLockValidatorReadRecUnionPtr(PRTLOCKVALIDATORRECUNION volatile *ppRec)117 { 118 return (PRTLOCKVAL IDATORRECUNION)ASMAtomicReadPtr((void * volatile *)ppRec);116 DECL_FORCE_INLINE(PRTLOCKVALRECUNION) rtLockValidatorReadRecUnionPtr(PRTLOCKVALRECUNION volatile *ppRec) 117 { 118 return (PRTLOCKVALRECUNION)ASMAtomicReadPtr((void * volatile *)ppRec); 119 119 } 120 120 121 121 122 122 /** Wrapper around ASMAtomicWritePtr. */ 123 DECL_FORCE_INLINE(void) rtLockValidatorWriteRecUnionPtr(PRTLOCKVAL IDATORRECUNION volatile *ppRec, PRTLOCKVALIDATORRECUNION pRecNew)123 DECL_FORCE_INLINE(void) rtLockValidatorWriteRecUnionPtr(PRTLOCKVALRECUNION volatile *ppRec, PRTLOCKVALRECUNION pRecNew) 124 124 { 125 125 ASMAtomicWritePtr((void * volatile *)ppRec, pRecNew); … … 135 135 136 136 /** Wrapper around ASMAtomicUoReadPtr. */ 137 DECL_FORCE_INLINE(PRTLOCKVAL IDATORSHAREDONE) rtLockValidatorUoReadSharedOwner(PRTLOCKVALIDATORSHAREDONEvolatile *ppOwner)138 { 139 return (PRTLOCKVAL IDATORSHAREDONE)ASMAtomicUoReadPtr((void * volatile *)ppOwner);137 DECL_FORCE_INLINE(PRTLOCKVALRECSHRDOWN) rtLockValidatorUoReadSharedOwner(PRTLOCKVALRECSHRDOWN volatile *ppOwner) 138 { 139 return (PRTLOCKVALRECSHRDOWN)ASMAtomicUoReadPtr((void * volatile *)ppOwner); 140 140 } 141 141 … … 189 189 * @param pszPrefix Message suffix. 190 190 */ 191 static void rtLockValidatorComplainAboutLock(const char *pszPrefix, PRTLOCKVAL IDATORRECUNION pRec, const char *pszSuffix)191 static void rtLockValidatorComplainAboutLock(const char *pszPrefix, PRTLOCKVALRECUNION pRec, const char *pszSuffix) 192 192 { 193 193 if ( VALID_PTR(pRec) … … 196 196 switch (pRec->Core.u32Magic) 197 197 { 198 case RTLOCKVAL IDATORREC_MAGIC:198 case RTLOCKVALRECEXCL_MAGIC: 199 199 RTAssertMsg2AddWeak("%s%p %s xrec=%p own=%s nest=%u pos={%Rbn(%u) %Rfn %p}%s", pszPrefix, 200 200 pRec->Excl.hLock, pRec->Excl.pszName, pRec, … … 204 204 break; 205 205 206 case RTLOCKVAL IDATORSHARED_MAGIC:206 case RTLOCKVALRECSHRD_MAGIC: 207 207 RTAssertMsg2AddWeak("%s%p %s srec=%p%s", pszPrefix, 208 208 pRec->Shared.hLock, pRec->Shared.pszName, pRec, … … 210 210 break; 211 211 212 case RTLOCKVAL IDATORSHAREDONE_MAGIC:212 case RTLOCKVALRECSHRDOWN_MAGIC: 213 213 { 214 PRTLOCKVAL IDATORSHARED pShared = pRec->SharedOne.pSharedRec;214 PRTLOCKVALRECSHRD pShared = pRec->SharedOwn.pSharedRec; 215 215 if ( VALID_PTR(pShared) 216 && pShared->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC)216 && pShared->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC) 217 217 RTAssertMsg2AddWeak("%s%p %s srec=%p trec=%p thr=%s nest=%u pos={%Rbn(%u) %Rfn %p}%s", pszPrefix, 218 218 pShared->hLock, pShared->pszName, pShared, 219 pRec, rtLockValidatorNameThreadHandle(&pRec->SharedO ne.hThread), pRec->SharedOne.cRecursion,220 pRec->SharedO ne.SrcPos.pszFile, pRec->SharedOne.SrcPos.uLine, pRec->SharedOne.SrcPos.pszFunction, pRec->SharedOne.SrcPos.uId,219 pRec, rtLockValidatorNameThreadHandle(&pRec->SharedOwn.hThread), pRec->SharedOwn.cRecursion, 220 pRec->SharedOwn.SrcPos.pszFile, pRec->SharedOwn.SrcPos.uLine, pRec->SharedOwn.SrcPos.pszFunction, pRec->SharedOwn.SrcPos.uId, 221 221 pszSuffix); 222 222 else 223 223 RTAssertMsg2AddWeak("%sbad srec=%p trec=%p thr=%s nest=%u pos={%Rbn(%u) %Rfn %p}%s", pszPrefix, 224 224 pShared, 225 pRec, rtLockValidatorNameThreadHandle(&pRec->SharedO ne.hThread), pRec->SharedOne.cRecursion,226 pRec->SharedO ne.SrcPos.pszFile, pRec->SharedOne.SrcPos.uLine, pRec->SharedOne.SrcPos.pszFunction, pRec->SharedOne.SrcPos.uId,225 pRec, rtLockValidatorNameThreadHandle(&pRec->SharedOwn.hThread), pRec->SharedOwn.cRecursion, 226 pRec->SharedOwn.SrcPos.pszFile, pRec->SharedOwn.SrcPos.uLine, pRec->SharedOwn.SrcPos.pszFunction, pRec->SharedOwn.SrcPos.uId, 227 227 pszSuffix); 228 228 break; … … 245 245 * @param pRec The main lock involved. Can be NULL. 246 246 */ 247 static void rtLockValidatorComplainFirst(const char *pszWhat, PCRTLOCKVAL IDATORSRCPOS pSrcPos, PRTTHREADINT pThreadSelf, PRTLOCKVALIDATORRECUNION pRec)247 static void rtLockValidatorComplainFirst(const char *pszWhat, PCRTLOCKVALSRCPOS pSrcPos, PRTTHREADINT pThreadSelf, PRTLOCKVALRECUNION pRec) 248 248 { 249 249 if (!ASMAtomicUoReadBool(&g_fLockValidatorQuiet)) … … 293 293 * @param pSrc The source. 294 294 */ 295 DECL_FORCE_INLINE(void) rtLockValidatorCopySrcPos(PRTLOCKVAL IDATORSRCPOS pDst, PCRTLOCKVALIDATORSRCPOS pSrc)295 DECL_FORCE_INLINE(void) rtLockValidatorCopySrcPos(PRTLOCKVALSRCPOS pDst, PCRTLOCKVALSRCPOS pSrc) 296 296 { 297 297 ASMAtomicUoWriteU32(&pDst->uLine, pSrc->uLine); … … 307 307 * @param pSrcPos The source position record. 308 308 */ 309 DECL_FORCE_INLINE(void) rtLockValidatorInitSrcPos(PRTLOCKVAL IDATORSRCPOS pSrcPos)309 DECL_FORCE_INLINE(void) rtLockValidatorInitSrcPos(PRTLOCKVALSRCPOS pSrcPos) 310 310 { 311 311 pSrcPos->pszFile = NULL; … … 320 320 321 321 /** 322 * Serializes destruction of RTLOCKVALIDATORREC and RTTHREADINT structures.322 * Serializes destruction of RTLOCKVALIDATORREC* and RTTHREADINT structures. 323 323 */ 324 324 DECLHIDDEN(void) rtLockValidatorSerializeDestructEnter(void) … … 364 364 365 365 366 RTDECL(void) RTLockValidatorRecInit(PRTLOCKVALIDATORREC pRec, RTLOCKVALIDATORCLASS hClass, 367 uint32_t uSubClass, const char *pszName, void *hLock) 368 { 369 pRec->Core.u32Magic = RTLOCKVALIDATORREC_MAGIC; 366 /** 367 * Unlinks all siblings. 368 * 369 * This is used during record deletion and assumes no races. 370 * 371 * @param pCore One of the siblings. 372 */ 373 static void rtLockValidatorUnlinkAllSiblings(PRTLOCKVALRECCORE pCore) 374 { 375 /* ASSUMES sibling destruction doesn't involve any races and that all 376 related records are to be disposed off now. */ 377 PRTLOCKVALRECUNION pSibling = (PRTLOCKVALRECUNION)pCore; 378 while (pSibling) 379 { 380 PRTLOCKVALRECUNION volatile *ppCoreNext; 381 switch (pSibling->Core.u32Magic) 382 { 383 case RTLOCKVALRECEXCL_MAGIC: 384 case RTLOCKVALRECEXCL_MAGIC_DEAD: 385 ppCoreNext = &pSibling->Excl.pSibling; 386 break; 387 388 case RTLOCKVALRECSHRD_MAGIC: 389 case RTLOCKVALRECSHRD_MAGIC_DEAD: 390 ppCoreNext = &pSibling->Shared.pSibling; 391 break; 392 393 default: 394 AssertFailed(); 395 ppCoreNext = NULL; 396 break; 397 } 398 if (RT_UNLIKELY(ppCoreNext)) 399 break; 400 pSibling = (PRTLOCKVALRECUNION)ASMAtomicXchgPtr((void * volatile *)ppCoreNext, NULL); 401 } 402 } 403 404 405 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALIDATORCLASS hClass, 406 uint32_t uSubClass, const char *pszName, void *hLock) 407 { 408 pRec->Core.u32Magic = RTLOCKVALRECEXCL_MAGIC; 370 409 pRec->fEnabled = RTLockValidatorIsEnabled(); 371 410 pRec->afReserved[0] = 0; … … 396 435 397 436 398 RTDECL(int) RTLockValidatorRec Create(PRTLOCKVALIDATORREC*ppRec, RTLOCKVALIDATORCLASS hClass,399 uint32_t uSubClass, const char *pszName, void *pvLock)400 { 401 PRTLOCKVAL IDATORRECpRec;402 *ppRec = pRec = (PRTLOCKVAL IDATORREC)RTMemAlloc(sizeof(*pRec));437 RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALIDATORCLASS hClass, 438 uint32_t uSubClass, const char *pszName, void *pvLock) 439 { 440 PRTLOCKVALRECEXCL pRec; 441 *ppRec = pRec = (PRTLOCKVALRECEXCL)RTMemAlloc(sizeof(*pRec)); 403 442 if (!pRec) 404 443 return VERR_NO_MEMORY; 405 444 406 RTLockValidatorRec Init(pRec, hClass, uSubClass, pszName, pvLock);445 RTLockValidatorRecExclInit(pRec, hClass, uSubClass, pszName, pvLock); 407 446 408 447 return VINF_SUCCESS; … … 410 449 411 450 412 /** 413 * Unlinks all siblings. 414 * 415 * This is used during record deletion and assumes no races. 416 * 417 * @param pCore One of the siblings. 418 */ 419 static void rtLockValidatorUnlinkAllSiblings(PRTLOCKVALIDATORRECCORE pCore) 420 { 421 /* ASSUMES sibling destruction doesn't involve any races and that all 422 related records are to be disposed off now. */ 423 PRTLOCKVALIDATORRECUNION pSibling = (PRTLOCKVALIDATORRECUNION)pCore; 424 while (pSibling) 425 { 426 PRTLOCKVALIDATORRECUNION volatile *ppCoreNext; 427 switch (pSibling->Core.u32Magic) 428 { 429 case RTLOCKVALIDATORREC_MAGIC: 430 case RTLOCKVALIDATORREC_MAGIC_DEAD: 431 ppCoreNext = &pSibling->Excl.pSibling; 432 break; 433 434 case RTLOCKVALIDATORSHARED_MAGIC: 435 case RTLOCKVALIDATORSHARED_MAGIC_DEAD: 436 ppCoreNext = &pSibling->Shared.pSibling; 437 break; 438 439 default: 440 AssertFailed(); 441 ppCoreNext = NULL; 442 break; 443 } 444 if (RT_UNLIKELY(ppCoreNext)) 445 break; 446 pSibling = (PRTLOCKVALIDATORRECUNION)ASMAtomicXchgPtr((void * volatile *)ppCoreNext, NULL); 447 } 448 } 449 450 451 RTDECL(void) RTLockValidatorRecDelete(PRTLOCKVALIDATORREC pRec) 452 { 453 Assert(pRec->Core.u32Magic == RTLOCKVALIDATORREC_MAGIC); 451 RTDECL(void) RTLockValidatorRecExclDelete(PRTLOCKVALRECEXCL pRec) 452 { 453 Assert(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC); 454 454 455 455 rtLockValidatorSerializeDestructEnter(); 456 456 457 ASMAtomicWriteU32(&pRec->Core.u32Magic, RTLOCKVAL IDATORREC_MAGIC_DEAD);457 ASMAtomicWriteU32(&pRec->Core.u32Magic, RTLOCKVALRECEXCL_MAGIC_DEAD); 458 458 ASMAtomicWriteHandle(&pRec->hThread, NIL_RTTHREAD); 459 459 ASMAtomicWriteHandle(&pRec->hClass, NIL_RTLOCKVALIDATORCLASS); … … 464 464 465 465 466 RTDECL(void) RTLockValidatorRec Destroy(PRTLOCKVALIDATORREC*ppRec)467 { 468 PRTLOCKVAL IDATORRECpRec = *ppRec;466 RTDECL(void) RTLockValidatorRecExclDestroy(PRTLOCKVALRECEXCL *ppRec) 467 { 468 PRTLOCKVALRECEXCL pRec = *ppRec; 469 469 *ppRec = NULL; 470 470 if (pRec) 471 471 { 472 RTLockValidatorRec Delete(pRec);472 RTLockValidatorRecExclDelete(pRec); 473 473 RTMemFree(pRec); 474 474 } … … 476 476 477 477 478 RTDECL(void) RTLockValidator SharedRecInit(PRTLOCKVALIDATORSHARED pRec, RTLOCKVALIDATORCLASS hClass,478 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALIDATORCLASS hClass, 479 479 uint32_t uSubClass, const char *pszName, void *hLock) 480 480 { 481 pRec->Core.u32Magic = RTLOCKVAL IDATORSHARED_MAGIC;481 pRec->Core.u32Magic = RTLOCKVALRECSHRD_MAGIC; 482 482 pRec->uSubClass = uSubClass; 483 483 pRec->hClass = hClass; … … 501 501 502 502 503 RTDECL(void) RTLockValidator SharedRecDelete(PRTLOCKVALIDATORSHARED pRec)504 { 505 Assert(pRec->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC);503 RTDECL(void) RTLockValidatorRecSharedDelete(PRTLOCKVALRECSHRD pRec) 504 { 505 Assert(pRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC); 506 506 507 507 /* … … 519 519 } 520 520 521 ASMAtomicWriteU32(&pRec->Core.u32Magic, RTLOCKVAL IDATORSHARED_MAGIC_DEAD);521 ASMAtomicWriteU32(&pRec->Core.u32Magic, RTLOCKVALRECSHRD_MAGIC_DEAD); 522 522 ASMAtomicUoWriteHandle(&pRec->hClass, NIL_RTLOCKVALIDATORCLASS); 523 523 if (pRec->papOwners) 524 524 { 525 PRTLOCKVAL IDATORSHAREDONEvolatile *papOwners = pRec->papOwners;525 PRTLOCKVALRECSHRDOWN volatile *papOwners = pRec->papOwners; 526 526 ASMAtomicUoWritePtr((void * volatile *)&pRec->papOwners, NULL); 527 527 ASMAtomicUoWriteU32(&pRec->cAllocated, 0); … … 545 545 * @param piEntry Where to optionally return the table in index. 546 546 */ 547 DECLINLINE(PRTLOCKVAL IDATORSHAREDONE)548 rtLockValidatorSharedRecFindThread(PRTLOCKVAL IDATORSHARED pShared, RTTHREAD hThread, uint32_t *piEntry)547 DECLINLINE(PRTLOCKVALRECSHRDOWN) 548 rtLockValidatorSharedRecFindThread(PRTLOCKVALRECSHRD pShared, RTTHREAD hThread, uint32_t *piEntry) 549 549 { 550 550 rtLockValidatorSerializeDetectionEnter(); 551 551 if (pShared->papOwners) 552 552 { 553 PRTLOCKVAL IDATORSHAREDONEvolatile *papOwners = pShared->papOwners;553 PRTLOCKVALRECSHRDOWN volatile *papOwners = pShared->papOwners; 554 554 uint32_t const cMax = pShared->cAllocated; 555 555 for (uint32_t iEntry = 0; iEntry < cMax; iEntry++) 556 556 { 557 PRTLOCKVAL IDATORSHAREDONEpEntry = rtLockValidatorUoReadSharedOwner(&papOwners[iEntry]);557 PRTLOCKVALRECSHRDOWN pEntry = rtLockValidatorUoReadSharedOwner(&papOwners[iEntry]); 558 558 if (pEntry && pEntry->hThread == hThread) 559 559 { … … 578 578 * @param pSrcPos The source position. 579 579 */ 580 DECLINLINE(PRTLOCKVAL IDATORSHAREDONE)581 rtLockValidatorSharedRecAllocThread(PRTLOCKVAL IDATORSHARED pRead, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos)582 { 583 PRTLOCKVAL IDATORSHAREDONEpEntry;584 585 pEntry = (PRTLOCKVAL IDATORSHAREDONE)RTMemAlloc(sizeof(RTLOCKVALIDATORSHAREDONE));580 DECLINLINE(PRTLOCKVALRECSHRDOWN) 581 rtLockValidatorSharedRecAllocThread(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos) 582 { 583 PRTLOCKVALRECSHRDOWN pEntry; 584 585 pEntry = (PRTLOCKVALRECSHRDOWN)RTMemAlloc(sizeof(RTLOCKVALRECSHRDOWN)); 586 586 if (pEntry) 587 587 { 588 pEntry->Core.u32Magic = RTLOCKVAL IDATORSHAREDONE_MAGIC;588 pEntry->Core.u32Magic = RTLOCKVALRECSHRDOWN_MAGIC; 589 589 pEntry->cRecursion = 1; 590 590 pEntry->hThread = hThread; … … 608 608 * @param pEntry The thread entry. 609 609 */ 610 DECLINLINE(void) rtLockValidatorSharedRecFreeThread(PRTLOCKVAL IDATORSHAREDONEpEntry)610 DECLINLINE(void) rtLockValidatorSharedRecFreeThread(PRTLOCKVALRECSHRDOWN pEntry) 611 611 { 612 612 if (pEntry) 613 613 { 614 614 rtLockValidatorSerializeDestructEnter(); 615 ASMAtomicWriteU32(&pEntry->Core.u32Magic, RTLOCKVAL IDATORSHAREDONE_MAGIC_DEAD);615 ASMAtomicWriteU32(&pEntry->Core.u32Magic, RTLOCKVALRECSHRDOWN_MAGIC_DEAD); 616 616 ASMAtomicWriteHandle(&pEntry->hThread, NIL_RTTHREAD); 617 617 rtLockValidatorSerializeDestructLeave(); … … 631 631 * @param pShared The shared lock record. 632 632 */ 633 static bool rtLockValidatorSharedRecMakeRoom(PRTLOCKVAL IDATORSHARED pShared)633 static bool rtLockValidatorSharedRecMakeRoom(PRTLOCKVALRECSHRD pShared) 634 634 { 635 635 for (unsigned i = 0; i < 1000; i++) … … 649 649 * Try grab the privilege to reallocating the table. 650 650 */ 651 if ( pShared->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC651 if ( pShared->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC 652 652 && ASMAtomicCmpXchgBool(&pShared->fReallocating, true, false)) 653 653 { … … 663 663 uint32_t cInc = RT_ALIGN_32(pShared->cEntries - cAllocated, 1); 664 664 #endif 665 PRTLOCKVAL IDATORSHAREDONE*papOwners;666 papOwners = (PRTLOCKVAL IDATORSHAREDONE*)RTMemRealloc((void *)pShared->papOwners,665 PRTLOCKVALRECSHRDOWN *papOwners; 666 papOwners = (PRTLOCKVALRECSHRDOWN *)RTMemRealloc((void *)pShared->papOwners, 667 667 (cAllocated + cInc) * sizeof(void *)); 668 668 if (!papOwners) … … 688 688 689 689 rtLockValidatorSerializeDetectionEnter(); 690 if (RT_UNLIKELY(pShared->Core.u32Magic != RTLOCKVAL IDATORSHARED_MAGIC))690 if (RT_UNLIKELY(pShared->Core.u32Magic != RTLOCKVALRECSHRD_MAGIC)) 691 691 break; 692 692 … … 708 708 * @param pEntry The thread entry. 709 709 */ 710 DECLINLINE(bool) rtLockValidatorSharedRecAddThread(PRTLOCKVAL IDATORSHARED pShared, PRTLOCKVALIDATORSHAREDONEpEntry)710 DECLINLINE(bool) rtLockValidatorSharedRecAddThread(PRTLOCKVALRECSHRD pShared, PRTLOCKVALRECSHRDOWN pEntry) 711 711 { 712 712 rtLockValidatorSerializeDetectionEnter(); 713 if (RT_LIKELY(pShared->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC)) /* paranoia */713 if (RT_LIKELY(pShared->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC)) /* paranoia */ 714 714 { 715 715 if ( ASMAtomicIncU32(&pShared->cEntries) > pShared->cAllocated /** @todo add fudge */ … … 717 717 return false; /* the worker leave the lock */ 718 718 719 PRTLOCKVAL IDATORSHAREDONEvolatile *papOwners = pShared->papOwners;719 PRTLOCKVALRECSHRDOWN volatile *papOwners = pShared->papOwners; 720 720 uint32_t const cMax = pShared->cAllocated; 721 721 for (unsigned i = 0; i < 100; i++) … … 745 745 * @param iEntry The last known index. 746 746 */ 747 DECLINLINE(void) rtLockValidatorSharedRecRemoveAndFree(PRTLOCKVAL IDATORSHARED pShared, PRTLOCKVALIDATORSHAREDONEpEntry,747 DECLINLINE(void) rtLockValidatorSharedRecRemoveAndFree(PRTLOCKVALRECSHRD pShared, PRTLOCKVALRECSHRDOWN pEntry, 748 748 uint32_t iEntry) 749 749 { … … 752 752 */ 753 753 rtLockValidatorSerializeDetectionEnter(); 754 AssertReturnVoidStmt(pShared->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC, rtLockValidatorSerializeDetectionLeave());754 AssertReturnVoidStmt(pShared->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, rtLockValidatorSerializeDetectionLeave()); 755 755 if (RT_UNLIKELY( iEntry >= pShared->cAllocated 756 756 || !ASMAtomicCmpXchgPtr((void * volatile *)&pShared->papOwners[iEntry], NULL, pEntry))) … … 758 758 /* this shouldn't happen yet... */ 759 759 AssertFailed(); 760 PRTLOCKVAL IDATORSHAREDONEvolatile *papOwners = pShared->papOwners;760 PRTLOCKVALRECSHRDOWN volatile *papOwners = pShared->papOwners; 761 761 uint32_t const cMax = pShared->cAllocated; 762 762 for (iEntry = 0; iEntry < cMax; iEntry++) … … 776 776 777 777 778 RTDECL(int) RTLockValidator MakeSiblings(PRTLOCKVALIDATORRECCORE pRec1, PRTLOCKVALIDATORRECCORE pRec2)778 RTDECL(int) RTLockValidatorRecMakeSiblings(PRTLOCKVALRECCORE pRec1, PRTLOCKVALRECCORE pRec2) 779 779 { 780 780 /* 781 781 * Validate input. 782 782 */ 783 PRTLOCKVAL IDATORRECUNION p1 = (PRTLOCKVALIDATORRECUNION)pRec1;784 PRTLOCKVAL IDATORRECUNION p2 = (PRTLOCKVALIDATORRECUNION)pRec2;783 PRTLOCKVALRECUNION p1 = (PRTLOCKVALRECUNION)pRec1; 784 PRTLOCKVALRECUNION p2 = (PRTLOCKVALRECUNION)pRec2; 785 785 786 786 AssertPtrReturn(p1, VERR_SEM_LV_INVALID_PARAMETER); 787 AssertReturn( p1->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC788 || p1->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC787 AssertReturn( p1->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC 788 || p1->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC 789 789 , VERR_SEM_LV_INVALID_PARAMETER); 790 790 791 791 AssertPtrReturn(p2, VERR_SEM_LV_INVALID_PARAMETER); 792 AssertReturn( p2->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC793 || p2->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC792 AssertReturn( p2->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC 793 || p2->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC 794 794 , VERR_SEM_LV_INVALID_PARAMETER); 795 795 796 796 /* 797 * Link them .798 */ 799 if ( p1->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC800 && p2->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC)797 * Link them (circular list). 798 */ 799 if ( p1->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC 800 && p2->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC) 801 801 { 802 802 p1->Excl.pSibling = p2; 803 803 p2->Shared.pSibling = p1; 804 804 } 805 else if ( p1->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC806 && p2->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC)805 else if ( p1->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC 806 && p2->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC) 807 807 { 808 808 p1->Shared.pSibling = p2; … … 816 816 817 817 818 RTDECL(int) RTLockValidatorCheckOrder(PRTLOCKVAL IDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos)819 { 820 AssertReturn(pRec->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);818 RTDECL(int) RTLockValidatorCheckOrder(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos) 819 { 820 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 821 821 if (!pRec->fEnabled) 822 822 return VINF_SUCCESS; … … 835 835 836 836 837 RTDECL(int) RTLockValidatorCheckAndRelease(PRTLOCKVAL IDATORRECpRec)838 { 839 AssertReturn(pRec->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);837 RTDECL(int) RTLockValidatorCheckAndRelease(PRTLOCKVALRECEXCL pRec) 838 { 839 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 840 840 if (!pRec->fEnabled) 841 841 return VINF_SUCCESS; … … 847 847 848 848 849 RTDECL(int) RTLockValidatorCheckAndReleaseReadOwner(PRTLOCKVAL IDATORSHARED pRead, RTTHREAD hThread)850 { 851 AssertReturn(pRead->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);849 RTDECL(int) RTLockValidatorCheckAndReleaseReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread) 850 { 851 AssertReturn(pRead->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 852 852 if (!pRead->fEnabled) 853 853 return VINF_SUCCESS; … … 858 858 */ 859 859 uint32_t iEntry = 0; 860 PRTLOCKVAL IDATORSHAREDONEpEntry = rtLockValidatorSharedRecFindThread(pRead, hThread, &iEntry);860 PRTLOCKVALRECSHRDOWN pEntry = rtLockValidatorSharedRecFindThread(pRead, hThread, &iEntry); 861 861 AssertReturn(pEntry, VERR_SEM_LV_NOT_OWNER); 862 862 … … 882 882 883 883 884 RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVAL IDATORREC pRec, PCRTLOCKVALIDATORSRCPOS pSrcPos)885 { 886 AssertReturn(pRec->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);884 RTDECL(int) RTLockValidatorRecordRecursion(PRTLOCKVALRECEXCL pRec, PCRTLOCKVALSRCPOS pSrcPos) 885 { 886 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 887 887 if (!pRec->fEnabled) 888 888 return VINF_SUCCESS; … … 896 896 897 897 898 RTDECL(int) RTLockValidatorUnwindRecursion(PRTLOCKVAL IDATORRECpRec)899 { 900 AssertReturn(pRec->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);898 RTDECL(int) RTLockValidatorUnwindRecursion(PRTLOCKVALRECEXCL pRec) 899 { 900 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 901 901 if (!pRec->fEnabled) 902 902 return VINF_SUCCESS; … … 910 910 911 911 912 RTDECL(int) RTLockValidatorRecordReadWriteRecursion(PRTLOCKVAL IDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead, PCRTLOCKVALIDATORSRCPOS pSrcPos)913 { 914 AssertReturn(pWrite->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);915 AssertReturn(pRead->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);912 RTDECL(int) RTLockValidatorRecordReadWriteRecursion(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead, PCRTLOCKVALSRCPOS pSrcPos) 913 { 914 AssertReturn(pWrite->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 915 AssertReturn(pRead->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 916 916 AssertReturn(pRead->fEnabled == pWrite->fEnabled, VERR_SEM_LV_INVALID_PARAMETER); 917 917 if (!pWrite->fEnabled) … … 927 927 928 928 929 RTDECL(int) RTLockValidatorUnwindReadWriteRecursion(PRTLOCKVAL IDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead)930 { 931 AssertReturn(pWrite->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);932 AssertReturn(pRead->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);929 RTDECL(int) RTLockValidatorUnwindReadWriteRecursion(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead) 930 { 931 AssertReturn(pWrite->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 932 AssertReturn(pRead->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 933 933 AssertReturn(pRead->fEnabled == pWrite->fEnabled, VERR_SEM_LV_INVALID_PARAMETER); 934 934 if (!pWrite->fEnabled) … … 943 943 944 944 945 RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVAL IDATORREC pRec, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos)946 { 947 AssertReturn(pRec->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, NIL_RTTHREAD);945 RTDECL(RTTHREAD) RTLockValidatorSetOwner(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos) 946 { 947 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, NIL_RTTHREAD); 948 948 if (!pRec->fEnabled) 949 949 return VINF_SUCCESS; … … 979 979 980 980 981 RTDECL(RTTHREAD) RTLockValidatorUnsetOwner(PRTLOCKVAL IDATORRECpRec)982 { 983 AssertReturn(pRec->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, NIL_RTTHREAD);981 RTDECL(RTTHREAD) RTLockValidatorUnsetOwner(PRTLOCKVALRECEXCL pRec) 982 { 983 AssertReturn(pRec->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, NIL_RTTHREAD); 984 984 if (!pRec->fEnabled) 985 985 return VINF_SUCCESS; … … 1006 1006 1007 1007 1008 RTDECL(void) RTLockValidatorAddReadOwner(PRTLOCKVAL IDATORSHARED pRead, RTTHREAD hThread, PCRTLOCKVALIDATORSRCPOS pSrcPos)1009 { 1010 AssertReturnVoid(pRead->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC);1008 RTDECL(void) RTLockValidatorAddReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread, PCRTLOCKVALSRCPOS pSrcPos) 1009 { 1010 AssertReturnVoid(pRead->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC); 1011 1011 if (!pRead->fEnabled) 1012 1012 return; … … 1020 1020 * so it can wait til later sometime. 1021 1021 */ 1022 PRTLOCKVAL IDATORSHAREDONEpEntry = rtLockValidatorSharedRecFindThread(pRead, hThread, NULL);1022 PRTLOCKVALRECSHRDOWN pEntry = rtLockValidatorSharedRecFindThread(pRead, hThread, NULL); 1023 1023 if (pEntry) 1024 1024 { … … 1037 1037 1038 1038 1039 RTDECL(void) RTLockValidatorRemoveReadOwner(PRTLOCKVAL IDATORSHARED pRead, RTTHREAD hThread)1040 { 1041 AssertReturnVoid(pRead->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC);1039 RTDECL(void) RTLockValidatorRemoveReadOwner(PRTLOCKVALRECSHRD pRead, RTTHREAD hThread) 1040 { 1041 AssertReturnVoid(pRead->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC); 1042 1042 if (!pRead->fEnabled) 1043 1043 return; … … 1048 1048 */ 1049 1049 uint32_t iEntry; 1050 PRTLOCKVAL IDATORSHAREDONEpEntry = rtLockValidatorSharedRecFindThread(pRead, hThread, &iEntry);1050 PRTLOCKVALRECSHRDOWN pEntry = rtLockValidatorSharedRecFindThread(pRead, hThread, &iEntry); 1051 1051 AssertReturnVoid(pEntry); 1052 1052 if (pEntry->cRecursion > 1) … … 1193 1193 * @param pFirstSibling The first record we examined. 1194 1194 */ 1195 DECL_FORCE_INLINE(bool) rtLockValidatorDdMoreWorkLeft(PRTLOCKVAL IDATORRECUNION pRec, uint32_t iEntry, PRTLOCKVALIDATORRECUNION pFirstSibling)1196 { 1197 PRTLOCKVAL IDATORRECUNION pSibling;1195 DECL_FORCE_INLINE(bool) rtLockValidatorDdMoreWorkLeft(PRTLOCKVALRECUNION pRec, uint32_t iEntry, PRTLOCKVALRECUNION pFirstSibling) 1196 { 1197 PRTLOCKVALRECUNION pSibling; 1198 1198 1199 1199 switch (pRec->Core.u32Magic) 1200 1200 { 1201 case RTLOCKVAL IDATORREC_MAGIC:1201 case RTLOCKVALRECEXCL_MAGIC: 1202 1202 pSibling = pRec->Excl.pSibling; 1203 1203 break; 1204 1204 1205 case RTLOCKVAL IDATORSHARED_MAGIC:1205 case RTLOCKVALRECSHRD_MAGIC: 1206 1206 if (iEntry + 1 < pRec->Shared.cAllocated) 1207 1207 return true; … … 1230 1230 * @param pThreadSelf The calling thread. 1231 1231 */ 1232 static int rtLockValidatorDdDoDetection(PRTLOCKVALIDATORDDSTACK pStack, PRTLOCKVAL IDATORRECUNION const pOriginalRec,1232 static int rtLockValidatorDdDoDetection(PRTLOCKVALIDATORDDSTACK pStack, PRTLOCKVALRECUNION const pOriginalRec, 1233 1233 PRTTHREADINT const pThreadSelf) 1234 1234 { … … 1237 1237 /* We could use a single RTLOCKVALIDATORDDENTRY variable here, but the 1238 1238 compiler may make a better job of it when using individual variables. */ 1239 PRTLOCKVAL IDATORRECUNION pRec = pOriginalRec;1240 PRTLOCKVAL IDATORRECUNION pFirstSibling = pOriginalRec;1239 PRTLOCKVALRECUNION pRec = pOriginalRec; 1240 PRTLOCKVALRECUNION pFirstSibling = pOriginalRec; 1241 1241 uint32_t iEntry = UINT32_MAX; 1242 1242 PRTTHREADINT pThread = NIL_RTTHREAD; … … 1251 1251 switch (pRec->Core.u32Magic) 1252 1252 { 1253 case RTLOCKVAL IDATORREC_MAGIC:1253 case RTLOCKVALRECEXCL_MAGIC: 1254 1254 Assert(iEntry == UINT32_MAX); 1255 1255 pNextThread = rtLockValidatorReadThreadHandle(&pRec->Excl.hThread); … … 1268 1268 break; 1269 1269 1270 case RTLOCKVAL IDATORSHARED_MAGIC:1270 case RTLOCKVALRECSHRD_MAGIC: 1271 1271 /* Skip to the next sibling if same side. ASSUMES reader priority. */ 1272 1272 /** @todo The read side of a read-write lock is problematic if … … 1295 1295 { 1296 1296 uint32_t cAllocated = ASMAtomicUoReadU32(&pRec->Shared.cAllocated); 1297 PRTLOCKVAL IDATORSHAREDONEvolatile *papOwners = pRec->Shared.papOwners;1297 PRTLOCKVALRECSHRDOWN volatile *papOwners = pRec->Shared.papOwners; 1298 1298 while (++iEntry < cAllocated) 1299 1299 { 1300 PRTLOCKVAL IDATORSHAREDONEpEntry = rtLockValidatorUoReadSharedOwner(&papOwners[iEntry]);1300 PRTLOCKVALRECSHRDOWN pEntry = rtLockValidatorUoReadSharedOwner(&papOwners[iEntry]); 1301 1301 if ( pEntry 1302 && pEntry->Core.u32Magic == RTLOCKVAL IDATORSHAREDONE_MAGIC)1302 && pEntry->Core.u32Magic == RTLOCKVALRECSHRDOWN_MAGIC) 1303 1303 { 1304 1304 pNextThread = rtLockValidatorReadThreadHandle(&pEntry->hThread); … … 1312 1312 } 1313 1313 else 1314 Assert(!pEntry || pEntry->Core.u32Magic == RTLOCKVAL IDATORSHAREDONE_MAGIC_DEAD);1314 Assert(!pEntry || pEntry->Core.u32Magic == RTLOCKVALRECSHRDOWN_MAGIC_DEAD); 1315 1315 } 1316 1316 if (pNextThread == NIL_RTTHREAD) … … 1328 1328 break; 1329 1329 1330 case RTLOCKVAL IDATORREC_MAGIC_DEAD:1331 case RTLOCKVAL IDATORSHARED_MAGIC_DEAD:1330 case RTLOCKVALRECEXCL_MAGIC_DEAD: 1331 case RTLOCKVALRECSHRD_MAGIC_DEAD: 1332 1332 pNextThread = NIL_RTTHREAD; 1333 1333 break; 1334 1334 1335 case RTLOCKVAL IDATORSHAREDONE_MAGIC:1336 case RTLOCKVAL IDATORSHAREDONE_MAGIC_DEAD:1335 case RTLOCKVALRECSHRDOWN_MAGIC: 1336 case RTLOCKVALRECSHRDOWN_MAGIC_DEAD: 1337 1337 default: 1338 1338 AssertMsgFailed(("%p: %#x\n", pRec, pRec->Core)); … … 1343 1343 /* If we found a thread, check if it is still waiting for something. */ 1344 1344 RTTHREADSTATE enmNextState = RTTHREADSTATE_RUNNING; 1345 PRTLOCKVAL IDATORRECUNION pNextRec = NULL;1345 PRTLOCKVALRECUNION pNextRec = NULL; 1346 1346 if ( pNextThread != NIL_RTTHREAD 1347 1347 && RT_LIKELY(pNextThread->u32Magic == RTTHREADINT_MAGIC)) … … 1423 1423 * @param pOriginalRec The original record. 1424 1424 */ 1425 DECLINLINE(int) rtLockValidatorIsSimpleNoDeadlockCase(PRTLOCKVAL IDATORRECUNION pOriginalRec)1426 { 1427 if ( pOriginalRec->Excl.Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC1425 DECLINLINE(int) rtLockValidatorIsSimpleNoDeadlockCase(PRTLOCKVALRECUNION pOriginalRec) 1426 { 1427 if ( pOriginalRec->Excl.Core.u32Magic == RTLOCKVALRECEXCL_MAGIC 1428 1428 && !pOriginalRec->Excl.pSibling) 1429 1429 { … … 1450 1450 * @param rc The return code. 1451 1451 */ 1452 static void rcLockValidatorDoDeadlockComplaining(PRTLOCKVALIDATORDDSTACK pStack, PRTLOCKVAL IDATORRECUNION pRec,1453 PRTTHREADINT pThreadSelf, PCRTLOCKVAL IDATORSRCPOS pSrcPos, int rc)1452 static void rcLockValidatorDoDeadlockComplaining(PRTLOCKVALIDATORDDSTACK pStack, PRTLOCKVALRECUNION pRec, 1453 PRTTHREADINT pThreadSelf, PCRTLOCKVALSRCPOS pSrcPos, int rc) 1454 1454 { 1455 1455 if (!ASMAtomicUoReadBool(&g_fLockValidatorQuiet)) … … 1468 1468 char szPrefix[24]; 1469 1469 RTStrPrintf(szPrefix, sizeof(szPrefix), "#%02u: ", i); 1470 PRTLOCKVAL IDATORSHAREDONE pSharedOne= NULL;1471 if (pStack->a[i].pRec->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC)1472 pSharedO ne= pStack->a[i].pRec->Shared.papOwners[pStack->a[i].iEntry];1473 if (VALID_PTR(pSharedO ne) && pSharedOne->Core.u32Magic == RTLOCKVALIDATORSHAREDONE_MAGIC)1474 rtLockValidatorComplainAboutLock(szPrefix, (PRTLOCKVAL IDATORRECUNION)pSharedOne, "\n");1470 PRTLOCKVALRECSHRDOWN pSharedOwn = NULL; 1471 if (pStack->a[i].pRec->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC) 1472 pSharedOwn = pStack->a[i].pRec->Shared.papOwners[pStack->a[i].iEntry]; 1473 if (VALID_PTR(pSharedOwn) && pSharedOwn->Core.u32Magic == RTLOCKVALRECSHRDOWN_MAGIC) 1474 rtLockValidatorComplainAboutLock(szPrefix, (PRTLOCKVALRECUNION)pSharedOwn, "\n"); 1475 1475 else 1476 1476 rtLockValidatorComplainAboutLock(szPrefix, pStack->a[i].pRec, "\n"); … … 1495 1495 * @param pSrcPos The position of the current lock operation. 1496 1496 */ 1497 static int rtLockValidatorDeadlockDetection(PRTLOCKVAL IDATORRECUNION pRec, PRTTHREADINT pThreadSelf, PCRTLOCKVALIDATORSRCPOS pSrcPos)1497 static int rtLockValidatorDeadlockDetection(PRTLOCKVALRECUNION pRec, PRTTHREADINT pThreadSelf, PCRTLOCKVALSRCPOS pSrcPos) 1498 1498 { 1499 1499 #ifdef DEBUG_bird … … 1527 1527 1528 1528 1529 RTDECL(int) RTLockValidatorCheckWriteOrderBlocking(PRTLOCKVAL IDATORREC pWrite, PRTLOCKVALIDATORSHARED pRead,1529 RTDECL(int) RTLockValidatorCheckWriteOrderBlocking(PRTLOCKVALRECEXCL pWrite, PRTLOCKVALRECSHRD pRead, 1530 1530 RTTHREAD hThread, RTTHREADSTATE enmState, bool fRecursiveOk, 1531 PCRTLOCKVAL IDATORSRCPOS pSrcPos)1531 PCRTLOCKVALSRCPOS pSrcPos) 1532 1532 { 1533 1533 /* 1534 1534 * Fend off wild life. 1535 1535 */ 1536 PRTLOCKVAL IDATORRECUNION pWriteU = (PRTLOCKVALIDATORRECUNION)pWrite; /* (avoid break aliasing rules) */1536 PRTLOCKVALRECUNION pWriteU = (PRTLOCKVALRECUNION)pWrite; /* (avoid break aliasing rules) */ 1537 1537 AssertPtrReturn(pWriteU, VERR_SEM_LV_INVALID_PARAMETER); 1538 AssertReturn(pWriteU->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);1539 PRTLOCKVAL IDATORRECUNION pReadU = (PRTLOCKVALIDATORRECUNION)pRead;1538 AssertReturn(pWriteU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1539 PRTLOCKVALRECUNION pReadU = (PRTLOCKVALRECUNION)pRead; 1540 1540 AssertPtrReturn(pRead, VERR_SEM_LV_INVALID_PARAMETER); 1541 AssertReturn(pReadU->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);1541 AssertReturn(pReadU->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1542 1542 AssertReturn(pReadU->Shared.fEnabled == pWriteU->Excl.fEnabled, VERR_SEM_LV_INVALID_PARAMETER); 1543 1543 if (!pWriteU->Excl.fEnabled) … … 1556 1556 * Check for attempts at doing a read upgrade. 1557 1557 */ 1558 PRTLOCKVAL IDATORSHAREDONEpEntry = rtLockValidatorSharedRecFindThread(&pReadU->Shared, hThread, NULL);1558 PRTLOCKVALRECSHRDOWN pEntry = rtLockValidatorSharedRecFindThread(&pReadU->Shared, hThread, NULL); 1559 1559 if (pEntry) 1560 1560 { 1561 rtLockValidatorComplainFirst("Read lock upgrade", pSrcPos, pThread, (PRTLOCKVAL IDATORRECUNION)pEntry);1561 rtLockValidatorComplainFirst("Read lock upgrade", pSrcPos, pThread, (PRTLOCKVALRECUNION)pEntry); 1562 1562 rtLockValidatorComplainPanic(); 1563 1563 return VERR_SEM_LV_UPGRADE; … … 1570 1570 1571 1571 1572 RTDECL(int) RTLockValidatorCheckReadOrderBlocking(PRTLOCKVAL IDATORSHARED pRead, PRTLOCKVALIDATORRECpWrite,1572 RTDECL(int) RTLockValidatorCheckReadOrderBlocking(PRTLOCKVALRECSHRD pRead, PRTLOCKVALRECEXCL pWrite, 1573 1573 RTTHREAD hThread, RTTHREADSTATE enmState, bool fRecursiveOk, 1574 PCRTLOCKVAL IDATORSRCPOS pSrcPos)1574 PCRTLOCKVALSRCPOS pSrcPos) 1575 1575 { 1576 1576 /* … … 1578 1578 */ 1579 1579 AssertPtrReturn(pRead, VERR_SEM_LV_INVALID_PARAMETER); 1580 AssertReturn(pRead->Core.u32Magic == RTLOCKVAL IDATORSHARED_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);1580 AssertReturn(pRead->Core.u32Magic == RTLOCKVALRECSHRD_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1581 1581 AssertPtrReturn(pWrite, VERR_SEM_LV_INVALID_PARAMETER); 1582 AssertReturn(pWrite->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);1582 AssertReturn(pWrite->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1583 1583 AssertReturn(pRead->fEnabled == pWrite->fEnabled, VERR_SEM_LV_INVALID_PARAMETER); 1584 1584 if (!pRead->fEnabled) … … 1600 1600 1601 1601 1602 RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVAL IDATORRECpRec, RTTHREAD hThread,1602 RTDECL(int) RTLockValidatorCheckBlocking(PRTLOCKVALRECEXCL pRec, RTTHREAD hThread, 1603 1603 RTTHREADSTATE enmState, bool fRecursiveOk, 1604 PCRTLOCKVAL IDATORSRCPOS pSrcPos)1604 PCRTLOCKVALSRCPOS pSrcPos) 1605 1605 { 1606 1606 /* 1607 1607 * Fend off wild life. 1608 1608 */ 1609 PRTLOCKVAL IDATORRECUNION pRecU = (PRTLOCKVALIDATORRECUNION)pRec;1609 PRTLOCKVALRECUNION pRecU = (PRTLOCKVALRECUNION)pRec; 1610 1610 AssertPtrReturn(pRecU, VERR_SEM_LV_INVALID_PARAMETER); 1611 AssertReturn(pRecU->Core.u32Magic == RTLOCKVAL IDATORREC_MAGIC, VERR_SEM_LV_INVALID_PARAMETER);1611 AssertReturn(pRecU->Core.u32Magic == RTLOCKVALRECEXCL_MAGIC, VERR_SEM_LV_INVALID_PARAMETER); 1612 1612 if (!pRecU->Excl.fEnabled) 1613 1613 return VINF_SUCCESS; -
trunk/src/VBox/Runtime/generic/critsect-generic.cpp
r25604 r25607 69 69 pCritSect->cLockers = -1; 70 70 pCritSect->NativeThreadOwner = NIL_RTNATIVETHREAD; 71 int rc = RTLockValidatorRec Create(&pCritSect->pValidatorRec, NIL_RTLOCKVALIDATORCLASS, 0, "RTCritSect", pCritSect);71 int rc = RTLockValidatorRecExclCreate(&pCritSect->pValidatorRec, NIL_RTLOCKVALIDATORCLASS, 0, "RTCritSect", pCritSect); 72 72 if (RT_SUCCESS(rc)) 73 73 { … … 75 75 if (RT_SUCCESS(rc)) 76 76 return VINF_SUCCESS; 77 RTLockValidatorRec Destroy(&pCritSect->pValidatorRec);77 RTLockValidatorRecExclDestroy(&pCritSect->pValidatorRec); 78 78 } 79 79 … … 86 86 87 87 88 DECL_FORCE_INLINE(int) rtCritSectTryEnter(PRTCRITSECT pCritSect, PCRTLOCKVAL IDATORSRCPOS pSrcPos)88 DECL_FORCE_INLINE(int) rtCritSectTryEnter(PRTCRITSECT pCritSect, PCRTLOCKVALSRCPOS pSrcPos) 89 89 { 90 90 Assert(pCritSect); … … 137 137 return rtCritSectTryEnter(pCritSect, NULL); 138 138 #else 139 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();139 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 140 140 return rtCritSectTryEnter(pCritSect, &SrcPos); 141 141 #endif … … 146 146 RTDECL(int) RTCritSectTryEnterDebug(PRTCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL) 147 147 { 148 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();148 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 149 149 return rtCritSectTryEnter(pCritSect, &SrcPos); 150 150 } … … 152 152 153 153 154 DECL_FORCE_INLINE(int) rtCritSectEnter(PRTCRITSECT pCritSect, PCRTLOCKVAL IDATORSRCPOS pSrcPos)154 DECL_FORCE_INLINE(int) rtCritSectEnter(PRTCRITSECT pCritSect, PCRTLOCKVALSRCPOS pSrcPos) 155 155 { 156 156 Assert(pCritSect); … … 238 238 return rtCritSectEnter(pCritSect, NULL); 239 239 #else 240 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();240 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 241 241 return rtCritSectEnter(pCritSect, &SrcPos); 242 242 #endif … … 247 247 RTDECL(int) RTCritSectEnterDebug(PRTCRITSECT pCritSect, RTHCUINTPTR uId, RT_SRC_POS_DECL) 248 248 { 249 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();249 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 250 250 return rtCritSectEnter(pCritSect, &SrcPos); 251 251 } … … 294 294 295 295 296 static int rtCritSectEnterMultiple(size_t cCritSects, PRTCRITSECT *papCritSects, PCRTLOCKVAL IDATORSRCPOS pSrcPos)296 static int rtCritSectEnterMultiple(size_t cCritSects, PRTCRITSECT *papCritSects, PCRTLOCKVALSRCPOS pSrcPos) 297 297 { 298 298 Assert(cCritSects > 0); … … 377 377 return rtCritSectEnterMultiple(cCritSects, papCritSects, NULL); 378 378 #else 379 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();379 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 380 380 return rtCritSectEnterMultiple(cCritSects, papCritSects, &SrcPos); 381 381 #endif … … 386 386 RTDECL(int) RTCritSectEnterMultipleDebug(size_t cCritSects, PRTCRITSECT *papCritSects, RTUINTPTR uId, RT_SRC_POS_DECL) 387 387 { 388 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();388 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 389 389 return rtCritSectEnterMultiple(cCritSects, papCritSects, &SrcPos); 390 390 } … … 435 435 AssertRC(rc); 436 436 437 RTLockValidatorRec Destroy(&pCritSect->pValidatorRec);437 RTLockValidatorRecExclDestroy(&pCritSect->pValidatorRec); 438 438 439 439 return rc; -
trunk/src/VBox/Runtime/include/internal/lockvalidator.h
r25602 r25607 41 41 * Record union for simplifying internal processing. 42 42 */ 43 typedef union RTLOCKVAL IDATORRECUNION43 typedef union RTLOCKVALRECUNION 44 44 { 45 RTLOCKVAL IDATORRECCORE Core;46 RTLOCKVAL IDATORRECExcl;47 RTLOCKVAL IDATORSHAREDShared;48 RTLOCKVAL IDATORSHAREDONE SharedOne;49 } RTLOCKVAL IDATORRECUNION;45 RTLOCKVALRECCORE Core; 46 RTLOCKVALRECEXCL Excl; 47 RTLOCKVALRECSHRD Shared; 48 RTLOCKVALRECSHRDOWN SharedOwn; 49 } RTLOCKVALRECUNION; 50 50 51 51 … … 58 58 { 59 59 /** What we're blocking on. */ 60 PRTLOCKVAL IDATORRECUNION volatilepRec;60 PRTLOCKVALRECUNION volatile pRec; 61 61 /** Where we are blocking. */ 62 RTLOCKVAL IDATORSRCPOSSrcPos;62 RTLOCKVALSRCPOS SrcPos; 63 63 /** Number of registered write locks, mutexes and critsects that this thread owns. */ 64 int32_t volatile 64 int32_t volatile cWriteLocks; 65 65 /** Number of registered read locks that this thread owns, nesting included. */ 66 int32_t volatile 66 int32_t volatile cReadLocks; 67 67 } RTLOCKVALIDATORPERTHREAD; 68 68 -
trunk/src/VBox/Runtime/include/internal/magics.h
r25491 r25607 68 68 #define RTLOCALIPCSESSION_MAGIC 0x19530414 69 69 /** The magic value for RTLOCKVALIDATORREC::u32Magic. (Vladimir Vladimirovich Nabokov) */ 70 #define RTLOCKVAL IDATORREC_MAGIC0x1899042270 #define RTLOCKVALRECEXCL_MAGIC 0x18990422 71 71 /** The dead magic value for RTLOCKVALIDATORREC::u32Magic. */ 72 #define RTLOCKVAL IDATORREC_MAGIC_DEAD0x1977070273 /** The magic value for RTLOCKVAL IDATORSHARED::u32Magic. (Agnar Mykle) */74 #define RTLOCKVAL IDATORSHARED_MAGIC0x1915080875 /** The magic value for RTLOCKVAL IDATORSHARED::u32Magic after deletion. */76 #define RTLOCKVAL IDATORSHARED_MAGIC_DEAD0x1994011577 /** The magic value for RTLOCKVAL IDATORSHAREDONE::u32Magic. (Jens Ingvald Bjoerneboe) */78 #define RTLOCKVAL IDATORSHAREDONE_MAGIC0x1920100979 /** The magic value for RTLOCKVAL IDATORSHAREDONE::u32Magic after deletion. */80 #define RTLOCKVAL IDATORSHAREDONE_MAGIC_DEAD 0x1976050972 #define RTLOCKVALRECEXCL_MAGIC_DEAD 0x19770702 73 /** The magic value for RTLOCKVALRECSHRD::u32Magic. (Agnar Mykle) */ 74 #define RTLOCKVALRECSHRD_MAGIC 0x19150808 75 /** The magic value for RTLOCKVALRECSHRD::u32Magic after deletion. */ 76 #define RTLOCKVALRECSHRD_MAGIC_DEAD 0x19940115 77 /** The magic value for RTLOCKVALRECSHRDOWN::u32Magic. (Jens Ingvald Bjoerneboe) */ 78 #define RTLOCKVALRECSHRDOWN_MAGIC 0x19201009 79 /** The magic value for RTLOCKVALRECSHRDOWN::u32Magic after deletion. */ 80 #define RTLOCKVALRECSHRDOWN_MAGIC_DEAD 0x19760509 81 81 /** Magic number for RTMEMCACHEINT::u32Magic. (Joseph Weizenbaum) */ 82 82 #define RTMEMCACHE_MAGIC 0x19230108 -
trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp
r25604 r25607 81 81 #ifdef RTSEMMUTEX_STRICT 82 82 /** Lock validator record associated with this mutex. */ 83 RTLOCKVAL IDATORRECValidatorRec;83 RTLOCKVALRECEXCL ValidatorRec; 84 84 #endif 85 85 }; … … 120 120 pThis->cNesting = 0; 121 121 #ifdef RTSEMMUTEX_STRICT 122 RTLockValidatorRec Init(&pThis->ValidatorRec, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemMutex", pThis);122 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemMutex", pThis); 123 123 #endif 124 124 … … 156 156 pThis->cNesting = 0; 157 157 #ifdef RTSEMMUTEX_STRICT 158 RTLockValidatorRec Delete(&pThis->ValidatorRec);158 RTLockValidatorRecExclDelete(&pThis->ValidatorRec); 159 159 #endif 160 160 … … 167 167 168 168 169 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies, bool fAutoResume, PCRTLOCKVAL IDATORSRCPOS pSrcPos)169 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies, bool fAutoResume, PCRTLOCKVALSRCPOS pSrcPos) 170 170 { 171 171 /* … … 310 310 int rc = rtSemMutexRequest(MutexSem, cMillies, true, NULL); 311 311 #else 312 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();312 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 313 313 int rc = rtSemMutexRequest(MutexSem, cMillies, true, &SrcPos); 314 314 #endif … … 320 320 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 321 321 { 322 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();322 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 323 323 int rc = rtSemMutexRequest(MutexSem, cMillies, true, &SrcPos); 324 324 Assert(rc != VERR_INTERRUPTED); … … 332 332 return rtSemMutexRequest(MutexSem, cMillies, false, NULL); 333 333 #else 334 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();334 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 335 335 return rtSemMutexRequest(MutexSem, cMillies, false, &SrcPos); 336 336 #endif … … 340 340 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 341 341 { 342 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();342 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 343 343 return rtSemMutexRequest(MutexSem, cMillies, false, &SrcPos); 344 344 } -
trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp
r25604 r25607 66 66 #ifdef RTSEMMUTEX_STRICT 67 67 /** Lock validator record associated with this mutex. */ 68 RTLOCKVAL IDATORRECValidatorRec;68 RTLOCKVALRECEXCL ValidatorRec; 69 69 #endif 70 70 }; … … 102 102 pThis->u32Magic = RTSEMMUTEX_MAGIC; 103 103 #ifdef RTSEMMUTEX_STRICT 104 RTLockValidatorRec Init(&pThis->ValidatorRec, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemMutex", pThis);104 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemMutex", pThis); 105 105 #endif 106 106 … … 147 147 pThis->cNesting = UINT32_MAX; 148 148 #ifdef RTSEMMUTEX_STRICT 149 RTLockValidatorRec Delete(&pThis->ValidatorRec);149 RTLockValidatorRecExclDelete(&pThis->ValidatorRec); 150 150 #endif 151 151 RTMemTmpFree(pThis); … … 155 155 156 156 157 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies, PCRTLOCKVAL IDATORSRCPOS pSrcPos)157 DECL_FORCE_INLINE(int) rtSemMutexRequest(RTSEMMUTEX MutexSem, unsigned cMillies, PCRTLOCKVALSRCPOS pSrcPos) 158 158 { 159 159 /* … … 259 259 return rtSemMutexRequest(MutexSem, cMillies, NULL); 260 260 #else 261 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();261 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 262 262 return rtSemMutexRequest(MutexSem, cMillies, &SrcPos); 263 263 #endif … … 267 267 RTDECL(int) RTSemMutexRequestDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 268 268 { 269 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();269 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 270 270 return rtSemMutexRequest(MutexSem, cMillies, &SrcPos); 271 271 } … … 278 278 return rtSemMutexRequest(MutexSem, cMillies, NULL); 279 279 #else 280 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();280 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 281 281 return rtSemMutexRequest(MutexSem, cMillies, &SrcPos); 282 282 #endif … … 286 286 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 287 287 { 288 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();288 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 289 289 return rtSemMutexRequest(MutexSem, cMillies, &SrcPos); 290 290 } -
trunk/src/VBox/Runtime/r3/posix/semrw-posix.cpp
r25604 r25607 86 86 #ifdef RTSEMRW_STRICT 87 87 /** The validator record for the writer. */ 88 RTLOCKVAL IDATORRECValidatorWrite;88 RTLOCKVALRECEXCL ValidatorWrite; 89 89 /** The validator record for the readers. */ 90 RTLOCKVAL IDATORSHAREDValidatorRead;90 RTLOCKVALRECSHRD ValidatorRead; 91 91 #endif 92 92 }; … … 119 119 pThis->Writer = (pthread_t)-1; 120 120 #ifdef RTSEMRW_STRICT 121 RTLockValidatorRec Init(&pThis->ValidatorWrite, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis);122 RTLockValidator SharedRecInit(&pThis->ValidatorRead, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis);123 RTLockValidator MakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core);121 RTLockValidatorRecExclInit(&pThis->ValidatorWrite, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis); 122 RTLockValidatorRecSharedInit(&pThis->ValidatorRead, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemRW", pThis); 123 RTLockValidatorRecMakeSiblings(&pThis->ValidatorWrite.Core, &pThis->ValidatorRead.Core); 124 124 #endif 125 125 *pRWSem = pThis; … … 163 163 { 164 164 #ifdef RTSEMRW_STRICT 165 RTLockValidator SharedRecDelete(&pThis->ValidatorRead);166 RTLockValidatorRec Delete(&pThis->ValidatorWrite);165 RTLockValidatorRecSharedDelete(&pThis->ValidatorRead); 166 RTLockValidatorRecExclDelete(&pThis->ValidatorWrite); 167 167 #endif 168 168 RTMemFree(pThis); … … 182 182 RTDECL(int) RTSemRWRequestRead(RTSEMRW RWSem, unsigned cMillies) 183 183 { 184 PRTLOCKVAL IDATORSRCPOS pSrcPos = NULL;184 PRTLOCKVALSRCPOS pSrcPos = NULL; 185 185 186 186 /* … … 346 346 347 347 348 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies, PCRTLOCKVAL IDATORSRCPOS pSrcPos)348 DECL_FORCE_INLINE(int) rtSemRWRequestWrite(RTSEMRW RWSem, unsigned cMillies, PCRTLOCKVALSRCPOS pSrcPos) 349 349 { 350 350 /* … … 452 452 return rtSemRWRequestWrite(RWSem, cMillies, NULL); 453 453 #else 454 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();454 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 455 455 return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos); 456 456 #endif … … 460 460 RTDECL(int) RTSemRWRequestWriteDebug(RTSEMRW RWSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 461 461 { 462 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();462 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 463 463 return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos); 464 464 } … … 471 471 return rtSemRWRequestWrite(RWSem, cMillies, NULL); 472 472 #else 473 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();473 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 474 474 return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos); 475 475 #endif … … 480 480 { 481 481 /* EINTR isn't returned by the wait functions we're using. */ 482 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();482 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 483 483 return rtSemRWRequestWrite(RWSem, cMillies, &SrcPos); 484 484 } -
trunk/src/VBox/Runtime/r3/win/semmutex-win.cpp
r25604 r25607 61 61 #ifdef RTSEMMUTEX_STRICT 62 62 /** Lock validator record associated with this mutex. */ 63 RTLOCKVAL IDATORRECValidatorRec;63 RTLOCKVALRECEXCL ValidatorRec; 64 64 #endif 65 65 }; … … 87 87 pThis->hMtx = hMtx; 88 88 #ifdef RTSEMMUTEX_STRICT 89 RTLockValidatorRec Init(&pThis->ValidatorRec, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemMutex", pThis);89 RTLockValidatorRecExclInit(&pThis->ValidatorRec, NIL_RTLOCKVALIDATORCLASS, RTLOCKVALIDATOR_SUB_CLASS_NONE, "RTSemMutex", pThis); 90 90 #endif 91 91 *pMutexSem = pThis; … … 127 127 128 128 #ifdef RTSEMMUTEX_STRICT 129 RTLockValidatorRec Delete(&pThis->ValidatorRec);129 RTLockValidatorRecExclDelete(&pThis->ValidatorRec); 130 130 #endif 131 131 RTMemFree(pThis); … … 142 142 * @param pSrcPos The source position of the caller. 143 143 */ 144 DECL_FORCE_INLINE(int) rtSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies, PCRTLOCKVAL IDATORSRCPOS pSrcPos)144 DECL_FORCE_INLINE(int) rtSemMutexRequestNoResume(RTSEMMUTEX MutexSem, unsigned cMillies, PCRTLOCKVALSRCPOS pSrcPos) 145 145 { 146 146 /* … … 205 205 return rtSemMutexRequestNoResume(MutexSem, cMillies, NULL); 206 206 #else 207 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();207 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 208 208 return rtSemMutexRequestNoResume(MutexSem, cMillies, &SrcPos); 209 209 #endif … … 213 213 RTDECL(int) RTSemMutexRequestNoResumeDebug(RTSEMMUTEX MutexSem, unsigned cMillies, RTHCUINTPTR uId, RT_SRC_POS_DECL) 214 214 { 215 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();215 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 216 216 return rtSemMutexRequestNoResume(MutexSem, cMillies, &SrcPos); 217 217 } -
trunk/src/VBox/VMM/PDMCritSect.cpp
r25491 r25607 127 127 if (RT_SUCCESS(rc)) 128 128 { 129 rc = RTLockValidatorRec Create(&pCritSect->Core.pValidatorRec, NIL_RTLOCKVALIDATORCLASS, 0, pszName, pCritSect);129 rc = RTLockValidatorRecExclCreate(&pCritSect->Core.pValidatorRec, NIL_RTLOCKVALIDATORCLASS, 0, pszName, pCritSect); 130 130 if (RT_SUCCESS(rc)) 131 131 { … … 245 245 int rc = SUPSemEventClose(pVM->pSession, hEvent); 246 246 AssertRC(rc); 247 RTLockValidatorRec Destroy(&pCritSect->Core.pValidatorRec);247 RTLockValidatorRecExclDestroy(&pCritSect->Core.pValidatorRec); 248 248 pCritSect->pNext = NULL; 249 249 pCritSect->pvKey = NULL; … … 396 396 397 397 #ifdef PDMCRITSECT_STRICT 398 RTLOCKVAL IDATORSRCPOS const SrcPos = pCritSect->s.Core.pValidatorRec->SrcPos;398 RTLOCKVALSRCPOS const SrcPos = pCritSect->s.Core.pValidatorRec->SrcPos; 399 399 #endif 400 400 PDMCritSectLeave(pCritSect); -
trunk/src/VBox/VMM/VMMAll/PDMAllCritSect.cpp
r25478 r25607 88 88 * @param hNativeSelf The native handle of this thread. 89 89 */ 90 DECL_FORCE_INLINE(int) pdmCritSectEnterFirst(PPDMCRITSECT pCritSect, RTNATIVETHREAD hNativeSelf, PCRTLOCKVAL IDATORSRCPOS pSrcPos)90 DECL_FORCE_INLINE(int) pdmCritSectEnterFirst(PPDMCRITSECT pCritSect, RTNATIVETHREAD hNativeSelf, PCRTLOCKVALSRCPOS pSrcPos) 91 91 { 92 92 AssertMsg(pCritSect->s.Core.NativeThreadOwner == NIL_RTNATIVETHREAD, ("NativeThreadOwner=%p\n", pCritSect->s.Core.NativeThreadOwner)); … … 113 113 * @param hNativeSelf The native thread handle. 114 114 */ 115 static int pdmR3CritSectEnterContended(PPDMCRITSECT pCritSect, RTNATIVETHREAD hNativeSelf, PCRTLOCKVAL IDATORSRCPOS pSrcPos)115 static int pdmR3CritSectEnterContended(PPDMCRITSECT pCritSect, RTNATIVETHREAD hNativeSelf, PCRTLOCKVALSRCPOS pSrcPos) 116 116 { 117 117 /* … … 170 170 * and the section is busy. 171 171 */ 172 DECL_FORCE_INLINE(int) pdmCritSectEnter(PPDMCRITSECT pCritSect, int rcBusy, PCRTLOCKVAL IDATORSRCPOS pSrcPos)172 DECL_FORCE_INLINE(int) pdmCritSectEnter(PPDMCRITSECT pCritSect, int rcBusy, PCRTLOCKVALSRCPOS pSrcPos) 173 173 { 174 174 Assert(pCritSect->s.Core.cNestings < 8); /* useful to catch incorrect locking */ … … 248 248 return pdmCritSectEnter(pCritSect, rcBusy, NULL); 249 249 #else 250 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();250 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 251 251 return pdmCritSectEnter(pCritSect, rcBusy, &SrcPos); 252 252 #endif … … 275 275 { 276 276 #ifdef PDMCRITSECT_STRICT 277 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();277 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 278 278 return pdmCritSectEnter(pCritSect, rcBusy, &SrcPos); 279 279 #else … … 293 293 * @param pCritSect The critical section. 294 294 */ 295 static int pdmCritSectTryEnter(PPDMCRITSECT pCritSect, PCRTLOCKVAL IDATORSRCPOS pSrcPos)295 static int pdmCritSectTryEnter(PPDMCRITSECT pCritSect, PCRTLOCKVALSRCPOS pSrcPos) 296 296 { 297 297 /* … … 349 349 return pdmCritSectTryEnter(pCritSect, NULL); 350 350 #else 351 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_NORMAL_API();351 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_NORMAL_API(); 352 352 return pdmCritSectTryEnter(pCritSect, &SrcPos); 353 353 #endif … … 375 375 { 376 376 #ifdef PDMCRITSECT_STRICT 377 RTLOCKVAL IDATORSRCPOS SrcPos = RTLOCKVALIDATORSRCPOS_INIT_DEBUG_API();377 RTLOCKVALSRCPOS SrcPos = RTLOCKVALSRCPOS_INIT_DEBUG_API(); 378 378 return pdmCritSectTryEnter(pCritSect, &SrcPos); 379 379 #else
Note:
See TracChangeset
for help on using the changeset viewer.