Changeset 25607 in vbox for trunk/include
- Timestamp:
- Dec 31, 2009 1:21:39 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56298
- Location:
- trunk/include/iprt
- Files:
-
- 3 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
Note:
See TracChangeset
for help on using the changeset viewer.