VirtualBox

Changeset 25682 in vbox for trunk/include


Ignore:
Timestamp:
Jan 7, 2010 3:23:30 PM (15 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
56400
Message:

iprt,pdmcritsect: RTMSINTERVAL, RTLockValidatorClass* and some related renaming.

Location:
trunk/include/iprt
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/lockvalidator.h

    r25645 r25682  
    9898#define RTLOCKVALSRCPOS_INIT_NORMAL_API() \
    9999    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())
    100107
    101108/** Pointer to a record of one ownership share.  */
     
    142149    uint32_t volatile                   uSubClass;
    143150    /** The lock class. */
    144     RTLOCKVALIDATORCLASS                hClass;
     151    RTLOCKVALCLASS                      hClass;
    145152    /** Pointer to the lock. */
    146153    RTHCPTR                             hLock;
     
    197204    uint32_t volatile                   uSubClass;
    198205    /** The lock class. */
    199     RTLOCKVALIDATORCLASS                hClass;
     206    RTLOCKVALCLASS                      hClass;
    200207    /** Pointer to the lock. */
    201208    RTHCPTR                             hLock;
     
    240247/** Not allowed to be taken with any other locks in the same class.
    241248  * This is the recommended value.  */
    242 #define RTLOCKVALIDATOR_SUB_CLASS_NONE  UINT32_C(0)
     249#define RTLOCKVAL_SUB_CLASS_NONE        UINT32_C(0)
    243250/** Any order is allowed within the class. */
    244 #define RTLOCKVALIDATOR_SUB_CLASS_ANY   UINT32_C(1)
     251#define RTLOCKVAL_SUB_CLASS_ANY         UINT32_C(1)
    245252/** The first user value. */
    246 #define RTLOCKVALIDATOR_SUB_CLASS_USER  UINT32_C(16)
     253#define RTLOCKVAL_SUB_CLASS_USER        UINT32_C(16)
    247254/** @} */
    248255
     
    263270 *
    264271 * @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.
    267275 * @param   uSubClass           The sub-class.  This is used to define lock
    268276 *                              order inside the same class.  If you don't know,
    269  *                              then pass RTLOCKVALIDATOR_SUB_CLASS_NONE.
     277 *                              then pass RTLOCKVAL_SUB_CLASS_NONE.
    270278 * @param   pszName             The lock name (optional).
    271279 * @param   hLock               The lock handle.
    272280 */
    273 RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALIDATORCLASS hClass,
     281RTDECL(void) RTLockValidatorRecExclInit(PRTLOCKVALRECEXCL pRec, RTLOCKVALCLASS hClass,
    274282                                        uint32_t uSubClass, const char *pszName, void *hLock);
    275283/**
     
    289297 * @return VINF_SUCCESS or VERR_NO_MEMORY.
    290298 * @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.
    293302 * @param   uSubClass           The sub-class.  This is used to define lock
    294303 *                              order inside the same class.  If you don't know,
    295  *                              then pass RTLOCKVALIDATOR_SUB_CLASS_NONE.
     304 *                              then pass RTLOCKVAL_SUB_CLASS_NONE.
    296305 * @param   pszName             The lock name (optional).
    297306 * @param   hLock               The lock handle.
    298307 */
    299 RTDECL(int)  RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALIDATORCLASS hClass,
     308RTDECL(int)  RTLockValidatorRecExclCreate(PRTLOCKVALRECEXCL *ppRec, RTLOCKVALCLASS hClass,
    300309                                          uint32_t uSubClass, const char *pszName, void *hLock);
    301310
     
    486495 *
    487496 * @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.
    490500 * @param   uSubClass           The sub-class.  This is used to define lock
    491501 *                              order inside the same class.  If you don't know,
    492  *                              then pass RTLOCKVALIDATOR_SUB_CLASS_NONE.
     502 *                              then pass RTLOCKVAL_SUB_CLASS_NONE.
    493503 * @param   pszName             The lock name (optional).
    494504 * @param   hLock               The lock handle.
     
    497507 *                              semaphore logic should be used.
    498508 */
    499 RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALIDATORCLASS hClass, uint32_t uSubClass,
     509RTDECL(void) RTLockValidatorRecSharedInit(PRTLOCKVALRECSHRD pRec, RTLOCKVALCLASS hClass, uint32_t uSubClass,
    500510                                          const char *pszName, void *hLock, bool fSignaller);
    501511/**
     
    711721
    712722
    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 */
     740RTDECL(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 */
     755RTDECL(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 */
     763RTDECL(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 */
     773RTDECL(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 */
     781RTDECL(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 */
     789RTDECL(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 */
     801RTDECL(int) RTLockValidatorClassAddPriorClass(RTLOCKVALCLASS hClass, RTLOCKVALCLASS hPriorClass);
    716802
    717803/**
  • trunk/include/iprt/types.h

    r25645 r25682  
    355355
    356356/** 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:
    358359 *
    359360 * @code
     
    365366 * @endcode
    366367 *
    367  * The compiler would warn with "ISO C++ forbids casting between pointer-to-function and
    368  * pointer-to-object". The purpose of this warning is not to bother the programmer but to
    369  * point out that he is probably doing something dangerous, assigning a pointer to executable
    370  * 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.
    371372 */
    372373typedef FNRT *PFNRT;
     374
     375/** Millisecond interval. */
     376typedef uint32_t            RTMSINTERVAL;
     377/** Pointer to a millisecond interval. */
     378typedef RTMSINTERVAL       *PRTMSINTERVAL;
     379/** Pointer to a const millisecond interval. */
     380typedef const RTMSINTERVAL *PCRTMSINTERVAL;
    373381
    374382
     
    11271135
    11281136/** Lock validator class handle. */
    1129 typedef R3R0PTRTYPE(struct RTLOCKVALIDATORCLASSINT *) RTLOCKVALIDATORCLASS;
     1137typedef R3R0PTRTYPE(struct RTLOCKVALCLASSINT *)     RTLOCKVALCLASS;
    11301138/** Pointer to a lock validator class handle. */
    1131 typedef RTLOCKVALIDATORCLASS                       *PRTLOCKVALIDATORCLASS;
     1139typedef RTLOCKVALCLASS                             *PRTLOCKVALCLASS;
    11321140/** Nil lock validator class handle. */
    1133 #define NIL_RTLOCKVALIDATORCLASS                    ((RTLOCKVALIDATORCLASS)0)
     1141#define NIL_RTLOCKVALCLASS                         ((RTLOCKVALCLASS)0)
    11341142
    11351143/** Ring-0 memory object handle. */
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette