Changeset 25704 in vbox for trunk/include
- Timestamp:
- Jan 10, 2010 8:12:30 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56439
- Location:
- trunk/include/iprt
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/critsect.h
r25685 r25704 125 125 * order inside the same class. If you don't know, 126 126 * then pass RTLOCKVAL_SUB_CLASS_NONE. 127 * @param pszName The lock name (optional). 127 * @param pszNameFmt Name format string for the lock validator, 128 * optional (NULL). Max length is 32 bytes. 129 * @param ... Format string arguments. 128 130 */ 129 131 RTDECL(int) RTCritSectInitEx(PRTCRITSECT pCritSect, uint32_t fFlags, 130 RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszName); 132 RTLOCKVALCLASS hClass, uint32_t uSubClass, const char *pszName, ...); 133 134 /** 135 * Changes the lock validator sub-class of the critical section. 136 * 137 * It is recommended to try make sure that nobody is using this critical section 138 * while changing the value. 139 * 140 * @returns The old sub-class. RTLOCKVAL_SUB_CLASS_INVALID is returns if the 141 * lock validator isn't compiled in or either of the parameters are 142 * invalid. 143 * @param pCritSect The critical section. 144 * @param uSubClass The new sub-class value. 145 */ 146 RTDECL(uint32_t) RTCritSectSetSubClass(PRTCRITSECT pCritSect, uint32_t uSubClass); 131 147 132 148 /** -
trunk/include/iprt/lockvalidator.h
r25703 r25704 153 153 /** Pointer to the lock. */ 154 154 RTHCPTR hLock; 155 /** The lock name. */156 R3R0PTRTYPE(const char *) pszName;157 155 /** Pointer to the next sibling record. 158 156 * This is used to find the read side of a read-write lock. */ 159 157 R3R0PTRTYPE(PRTLOCKVALRECUNION) pSibling; 158 /** The lock name. 159 * @remarks The bytes beyond 32 are for better size alignment and can be 160 * taken and used for other purposes if it becomes necessary. */ 161 char szName[32 + (HC_ARCH_BITS == 32 ? 12 : 8)]; 160 162 } RTLOCKVALRECEXCL; 161 AssertCompileSize(RTLOCKVALRECEXCL, HC_ARCH_BITS == 32 ? 8 + 16 + 32 : 8 + 32 + 56);163 AssertCompileSize(RTLOCKVALRECEXCL, HC_ARCH_BITS == 32 ? 0x60 : 0x80); 162 164 /* The pointer type is defined in iprt/types.h. */ 163 165 … … 208 210 /** Pointer to the lock. */ 209 211 RTHCPTR hLock; 210 /** The lock name. */211 R3R0PTRTYPE(const char *) pszName;212 212 /** Pointer to the next sibling record. 213 213 * This is used to find the write side of a read-write lock. */ … … 234 234 /** Pointer to a table containing pointers to records of all the owners. */ 235 235 R3R0PTRTYPE(PRTLOCKVALRECSHRDOWN volatile *) papOwners; 236 #if HC_ARCH_BITS == 32 237 /** Alignment padding. */ 238 uint32_t u32Alignment; 239 #endif 236 237 /** The lock name. 238 * @remarks The bytes beyond 32 are for better size alignment and can be 239 * taken and used for other purposes if it becomes necessary. */ 240 char szName[32 + (HC_ARCH_BITS == 32 ? 8 : 8)]; 240 241 } RTLOCKVALRECSHRD; 241 AssertCompileSize(RTLOCKVALRECSHRD, HC_ARCH_BITS == 32 ? 24 + 20 + 4 : 40 + 24);242 AssertCompileSize(RTLOCKVALRECSHRD, HC_ARCH_BITS == 32 ? 0x50 : 0x60); 242 243 243 244 … … 264 265 * order inside the same class. If you don't know, 265 266 * then pass RTLOCKVAL_SUB_CLASS_NONE. 266 * @param pszName The lock name (optional).267 267 * @param hLock The lock handle. 268 268 * @param fEnabled Pass @c false to explicitly disable lock 269 269 * validation, otherwise @c true. 270 * @param pszNameFmt Name format string for the lock validator, 271 * optional (NULL). Max length is 32 bytes. 272 * @param ... Format string arguments. 270 273 */ 271 274 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 272 const char *pszName, void *hLock, bool fEnabled); 275 void *hLock, bool fEnabled, const char *pszNameFmt, ...); 276 /** 277 * Initialize a lock validator record. 278 * 279 * Use RTLockValidatorRecExclDelete to deinitialize it. 280 * 281 * @param pRec The record. 282 * @param hClass The class (no reference consumed). If NIL, the 283 * no lock order validation will be performed on 284 * this lock. 285 * @param uSubClass The sub-class. This is used to define lock 286 * order inside the same class. If you don't know, 287 * then pass RTLOCKVAL_SUB_CLASS_NONE. 288 * @param hLock The lock handle. 289 * @param fEnabled Pass @c false to explicitly disable lock 290 * validation, otherwise @c true. 291 * @param pszNameFmt Name format string for the lock validator, 292 * optional (NULL). Max length is 32 bytes. 293 * @param va Format string arguments. 294 */ 295 RTDECL(void) RTLockValidatorRecExclInitV(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 296 void *hLock, bool fEnabled, const char *pszNameFmt, va_list va); 273 297 /** 274 298 * Uninitialize a lock validator record previously initialized by … … 293 317 * order inside the same class. If you don't know, 294 318 * then pass RTLOCKVAL_SUB_CLASS_NONE. 295 * @param pszName The lock name (optional).296 319 * @param hLock The lock handle. 297 320 * @param fEnabled Pass @c false to explicitly disable lock 298 321 * validation, otherwise @c true. 322 * @param pszNameFmt Name format string for the lock validator, 323 * optional (NULL). Max length is 32 bytes. 324 * @param ... Format string arguments. 299 325 */ 300 326 RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 301 const char *pszName, void *hLock, bool fEnabled); 327 void *hLock, bool fEnabled, const char *pszNameFmt, ...); 328 329 /** 330 * Create and initialize a lock validator record. 331 * 332 * Use RTLockValidatorRecExclDestroy to deinitialize and destroy the returned 333 * record. 334 * 335 * @return VINF_SUCCESS or VERR_NO_MEMORY. 336 * @param ppRec Where to return the record pointer. 337 * @param hClass The class (no reference consumed). If NIL, the 338 * no lock order validation will be performed on 339 * this lock. 340 * @param uSubClass The sub-class. This is used to define lock 341 * order inside the same class. If you don't know, 342 * then pass RTLOCKVAL_SUB_CLASS_NONE. 343 * @param hLock The lock handle. 344 * @param fEnabled Pass @c false to explicitly disable lock 345 * validation, otherwise @c true. 346 * @param pszNameFmt Name format string for the lock validator, 347 * optional (NULL). Max length is 32 bytes. 348 * @param va Format string arguments. 349 */ 350 RTDECL(int) RTLockValidatorRecExclCreateV(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 351 void *hLock, bool fEnabled, const char *pszNameFmt, va_list va); 302 352 303 353 /** … … 308 358 */ 309 359 RTDECL(void) RTLockValidatorRecExclDestroy(PRTLOCKVALRECEXCL *ppRec); 360 361 /** 362 * Sets the sub-class of the record. 363 * 364 * It is recommended to try make sure that nobody is using this class while 365 * changing the value. 366 * 367 * @returns The old sub-class. RTLOCKVAL_SUB_CLASS_INVALID is returns if the 368 * lock validator isn't compiled in or either of the parameters are 369 * invalid. 370 * @param pRec The validator record. 371 * @param uSubClass The new sub-class value. 372 */ 373 RTDECL(uint32_t) RTLockValidatorRecExclSetSubClass(PRTLOCKVALRECEXCL pRec, uint32_t uSubClass); 310 374 311 375 /** … … 497 561 * order inside the same class. If you don't know, 498 562 * then pass RTLOCKVAL_SUB_CLASS_NONE. 499 * @param pszName The lock name (optional).500 563 * @param hLock The lock handle. 501 564 * @param fSignaller Set if event semaphore signaller logic should be … … 504 567 * @param fEnabled Pass @c false to explicitly disable lock 505 568 * validation, otherwise @c true. 569 * @param pszNameFmt Name format string for the lock validator, 570 * optional (NULL). Max length is 32 bytes. 571 * @param ... Format string arguments. 506 572 */ 507 573 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 508 const char *pszName, void *hLock, bool fSignaller, bool fEnabled); 574 void *hLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, ...); 575 /** 576 * Initialize a lock validator record for a shared lock. 577 * 578 * Use RTLockValidatorRecSharedDelete to deinitialize it. 579 * 580 * @param pRec The shared lock record. 581 * @param hClass The class (no reference consumed). If NIL, the 582 * no lock order validation will be performed on 583 * this lock. 584 * @param uSubClass The sub-class. This is used to define lock 585 * order inside the same class. If you don't know, 586 * then pass RTLOCKVAL_SUB_CLASS_NONE. 587 * @param hLock The lock handle. 588 * @param fSignaller Set if event semaphore signaller logic should be 589 * applied to this record, clear if read-write 590 * semaphore logic should be used. 591 * @param fEnabled Pass @c false to explicitly disable lock 592 * validation, otherwise @c true. 593 * @param pszNameFmt Name format string for the lock validator, 594 * optional (NULL). Max length is 32 bytes. 595 * @param va Format string arguments. 596 */ 597 RTDECL(void) RTLockValidatorRecSharedInitV(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 598 void *hLock, bool fSignaller, bool fEnabled, const char *pszNameFmt, va_list va); 509 599 /** 510 600 * Uninitialize a lock validator record previously initialized by … … 790 880 * @param iLine The source position of the call, line. 791 881 * @param pszFunction The source position of the call, function. 792 */ 793 RTDECL(int) RTLockValidatorClassCreate(PRTLOCKVALCLASS phClass, bool fAutodidact, RT_SRC_POS_DECL); 882 * @param pszNameFmt Class name format string, optional (NULL). Max 883 * length is 32 bytes. 884 * @param ... Format string arguments. 885 */ 886 RTDECL(int) RTLockValidatorClassCreate(PRTLOCKVALCLASS phClass, bool fAutodidact, RT_SRC_POS_DECL, const char *pszNameFmt, ...); 794 887 795 888 /** -
trunk/include/iprt/types.h
r25692 r25704 1500 1500 * taking in ascending order. 1501 1501 * @{ */ 1502 /** Invalid value. */ 1503 #define RTLOCKVAL_SUB_CLASS_INVALID UINT32_C(0) 1502 1504 /** Not allowed to be taken with any other locks in the same class. 1503 1505 * This is the recommended value. */ 1504 #define RTLOCKVAL_SUB_CLASS_NONE UINT32_C( 0)1506 #define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(1) 1505 1507 /** Any order is allowed within the class. */ 1506 #define RTLOCKVAL_SUB_CLASS_ANY UINT32_C( 1)1508 #define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(2) 1507 1509 /** The first user value. */ 1508 1510 #define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16)
Note:
See TracChangeset
for help on using the changeset viewer.