Changeset 25682 in vbox for trunk/include
- Timestamp:
- Jan 7, 2010 3:23:30 PM (15 years ago)
- svn:sync-xref-src-repo-rev:
- 56400
- Location:
- trunk/include/iprt
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/lockvalidator.h
r25645 r25682 98 98 #define RTLOCKVALSRCPOS_INIT_NORMAL_API() \ 99 99 RTLOCKVALSRCPOS_INIT(__FILE__, __LINE__, __PRETTY_FUNCTION__, (uintptr_t)ASMReturnAddress()) 100 101 /** @def RTLOCKVALSRCPOS_INIT_POS_NO_ID 102 * Initializer for a RTLOCKVALSRCPOS variable when no @c uId is present. 103 * Assumes iprt/asm.h is included. 104 */ 105 #define RTLOCKVALSRCPOS_INIT_POS_NO_ID() \ 106 RTLOCKVALSRCPOS_INIT(pszFile, iLine, pszFunction, (uintptr_t)ASMReturnAddress()) 100 107 101 108 /** Pointer to a record of one ownership share. */ … … 142 149 uint32_t volatile uSubClass; 143 150 /** The lock class. */ 144 RTLOCKVAL IDATORCLASShClass;151 RTLOCKVALCLASS hClass; 145 152 /** Pointer to the lock. */ 146 153 RTHCPTR hLock; … … 197 204 uint32_t volatile uSubClass; 198 205 /** The lock class. */ 199 RTLOCKVAL IDATORCLASShClass;206 RTLOCKVALCLASS hClass; 200 207 /** Pointer to the lock. */ 201 208 RTHCPTR hLock; … … 240 247 /** Not allowed to be taken with any other locks in the same class. 241 248 * This is the recommended value. */ 242 #define RTLOCKVAL IDATOR_SUB_CLASS_NONEUINT32_C(0)249 #define RTLOCKVAL_SUB_CLASS_NONE UINT32_C(0) 243 250 /** Any order is allowed within the class. */ 244 #define RTLOCKVAL IDATOR_SUB_CLASS_ANYUINT32_C(1)251 #define RTLOCKVAL_SUB_CLASS_ANY UINT32_C(1) 245 252 /** The first user value. */ 246 #define RTLOCKVAL IDATOR_SUB_CLASS_USERUINT32_C(16)253 #define RTLOCKVAL_SUB_CLASS_USER UINT32_C(16) 247 254 /** @} */ 248 255 … … 263 270 * 264 271 * @param pRec The record. 265 * @param hClass The class. If NIL, the no lock order 266 * validation will be performed on this lock. 272 * @param hClass The class (no reference consumed). If NIL, the 273 * no lock order validation will be performed on 274 * this lock. 267 275 * @param uSubClass The sub-class. This is used to define lock 268 276 * order inside the same class. If you don't know, 269 * then pass RTLOCKVAL IDATOR_SUB_CLASS_NONE.277 * then pass RTLOCKVAL_SUB_CLASS_NONE. 270 278 * @param pszName The lock name (optional). 271 279 * @param hLock The lock handle. 272 280 */ 273 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVAL IDATORCLASS hClass,281 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass, 274 282 uint32_t uSubClass, const char *pszName, void *hLock); 275 283 /** … … 289 297 * @return VINF_SUCCESS or VERR_NO_MEMORY. 290 298 * @param ppRec Where to return the record pointer. 291 * @param hClass The class. If NIL, the no lock order 292 * validation will be performed on this lock. 299 * @param hClass The class (no reference consumed). If NIL, the 300 * no lock order validation will be performed on 301 * this lock. 293 302 * @param uSubClass The sub-class. This is used to define lock 294 303 * order inside the same class. If you don't know, 295 * then pass RTLOCKVAL IDATOR_SUB_CLASS_NONE.304 * then pass RTLOCKVAL_SUB_CLASS_NONE. 296 305 * @param pszName The lock name (optional). 297 306 * @param hLock The lock handle. 298 307 */ 299 RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVAL IDATORCLASS hClass,308 RTDECL(int) RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass, 300 309 uint32_t uSubClass, const char *pszName, void *hLock); 301 310 … … 486 495 * 487 496 * @param pRec The shared lock record. 488 * @param hClass The class. If NIL, the no lock order 489 * validation will be performed on this lock. 497 * @param hClass The class (no reference consumed). If NIL, the 498 * no lock order validation will be performed on 499 * this lock. 490 500 * @param uSubClass The sub-class. This is used to define lock 491 501 * order inside the same class. If you don't know, 492 * then pass RTLOCKVAL IDATOR_SUB_CLASS_NONE.502 * then pass RTLOCKVAL_SUB_CLASS_NONE. 493 503 * @param pszName The lock name (optional). 494 504 * @param hLock The lock handle. … … 497 507 * semaphore logic should be used. 498 508 */ 499 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVAL IDATORCLASS hClass, uint32_t uSubClass,509 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass, 500 510 const char *pszName, void *hLock, bool fSignaller); 501 511 /** … … 711 721 712 722 713 /*RTDECL(int) RTLockValidatorClassCreate();*/ 714 715 723 724 /** 725 * Creates a new lock validator class, all properties specified. 726 * 727 * @returns IPRT status code 728 * @param phClass Where to return the class handle. 729 * @param pSrcPos The source position of the create call. 730 * @param fAutodidact Whether the class should be allowed to teach 731 * itself new locking order rules (true), or if the 732 * user will teach it all it needs to know (false). 733 * @param cMsMinDeadlock Used to raise the sleep interval at which 734 * deadlock detection kicks in. Minimum is 1 ms, 735 * while RT_INDEFINITE_WAIT will disable it. 736 * @param cMsMinOrder Used to raise the sleep interval at which lock 737 * order validation kicks in. Minimum is 1 ms, 738 * while RT_INDEFINITE_WAIT will disable it. 739 */ 740 RTDECL(int) RTLockValidatorClassCreateEx(PRTLOCKVALCLASS phClass, PCRTLOCKVALSRCPOS pSrcPos, 741 bool fAutodidact, RTMSINTERVAL cMsMinDeadlock, RTMSINTERVAL cMsMinOrder); 742 743 /** 744 * Creates a new lock validator class. 745 * 746 * @returns IPRT status code 747 * @param phClass Where to return the class handle. 748 * @param fAutodidact Whether the class should be allowed to teach 749 * itself new locking order rules (true), or if the 750 * user will teach it all it needs to know (false). 751 * @param pszFile The source position of the call, file. 752 * @param iLine The source position of the call, line. 753 * @param pszFunction The source position of the call, function. 754 */ 755 RTDECL(int) RTLockValidatorClassCreate(PRTLOCKVALCLASS phClass, bool fAutodidact, RT_SRC_POS_DECL); 756 757 /** 758 * Finds a class for the specified source position. 759 * 760 * @returns A handle to the class (not retained!) or NIL_RTLOCKVALCLASS. 761 * @param pSrcPos The source position. 762 */ 763 RTDECL(RTLOCKVALCLASS) RTLockValidatorClassFindForSrcPos(PRTLOCKVALSRCPOS pSrcPos); 764 765 /** 766 * Finds or creates a class given the source position. 767 * 768 * @returns Class handle (not retained!) or NIL_RTLOCKVALCLASS. 769 * @param pszFile The source file. 770 * @param iLine The line in that source file. 771 * @param pszFunction The function name. 772 */ 773 RTDECL(RTLOCKVALCLASS) RTLockValidatorClassForSrcPos(RT_SRC_POS_DECL); 774 775 /** 776 * Retains a reference to a lock validator class. 777 * 778 * @returns New reference count; UINT32_MAX if the handle is invalid. 779 * @param hClass Handle to the class. 780 */ 781 RTDECL(uint32_t) RTLockValidatorClassRetain(RTLOCKVALCLASS hClass); 782 783 /** 784 * Releases a reference to a lock validator class. 785 * 786 * @returns New reference count; UINT32_MAX if the handle is invalid. 787 * @param hClass Handle to the class. 788 */ 789 RTDECL(uint32_t) RTLockValidatorClassRelease(RTLOCKVALCLASS hClass); 790 791 /** 792 * Teaches the class @a hClass that locks in the class @a hPriorClass can be 793 * held when taking a lock of class @hClass 794 * 795 * @returns IPRT status. 796 * @param hClass Handle to the pupil class. 797 * @param hPriorClass Handle to the class that can be held prior to 798 * taking a lock in the pupil class. (No reference 799 * is consumed.) 800 */ 801 RTDECL(int) RTLockValidatorClassAddPriorClass(RTLOCKVALCLASS hClass, RTLOCKVALCLASS hPriorClass); 716 802 717 803 /** -
trunk/include/iprt/types.h
r25645 r25682 355 355 356 356 /** Generic function pointer. 357 * With -pedantic, gcc-4 complains when casting a function to a data object, for example 357 * With -pedantic, gcc-4 complains when casting a function to a data object, for 358 * example: 358 359 * 359 360 * @code … … 365 366 * @endcode 366 367 * 367 * The compiler would warn with "ISO C++ forbids casting between pointer-to-function and368 * pointer-to- object". The purpose of this warning is not to bother the programmer but to369 * point out that he is probably doing something dangerous, assigning a pointer to executable370 * code to a data object.368 * The compiler would warn with "ISO C++ forbids casting between 369 * pointer-to-function and pointer-to-object". The purpose of this warning is 370 * not to bother the programmer but to point out that he is probably doing 371 * something dangerous, assigning a pointer to executable code to a data object. 371 372 */ 372 373 typedef FNRT *PFNRT; 374 375 /** Millisecond interval. */ 376 typedef uint32_t RTMSINTERVAL; 377 /** Pointer to a millisecond interval. */ 378 typedef RTMSINTERVAL *PRTMSINTERVAL; 379 /** Pointer to a const millisecond interval. */ 380 typedef const RTMSINTERVAL *PCRTMSINTERVAL; 373 381 374 382 … … 1127 1135 1128 1136 /** Lock validator class handle. */ 1129 typedef R3R0PTRTYPE(struct RTLOCKVAL IDATORCLASSINT *) RTLOCKVALIDATORCLASS;1137 typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT *) RTLOCKVALCLASS; 1130 1138 /** Pointer to a lock validator class handle. */ 1131 typedef RTLOCKVAL IDATORCLASS *PRTLOCKVALIDATORCLASS;1139 typedef RTLOCKVALCLASS *PRTLOCKVALCLASS; 1132 1140 /** Nil lock validator class handle. */ 1133 #define NIL_RTLOCKVAL IDATORCLASS ((RTLOCKVALIDATORCLASS)0)1141 #define NIL_RTLOCKVALCLASS ((RTLOCKVALCLASS)0) 1134 1142 1135 1143 /** Ring-0 memory object handle. */
Note:
See TracChangeset
for help on using the changeset viewer.