VirtualBox

Changeset 25406 in vbox for trunk/src/VBox/Runtime/include


Ignore:
Timestamp:
Dec 15, 2009 2:23:53 PM (15 years ago)
Author:
vboxsync
Message:

IPRT,PDMCritSect: Lock validation can only be performed in ring-3; fixed #PF on 32-bit darwin with debug builds. Hopefully fixed the recursion issue on windows.

Location:
trunk/src/VBox/Runtime/include/internal
Files:
1 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/include/internal/strict.h

    r25398 r25406  
    3838 * Enables strictness checks and lock accounting of the RTCritSect API.
    3939 */
    40 #if defined(DOXYGEN_RUNNING) || (!defined(RTCRITSECT_STRICT) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT)))
     40#if defined(DOXYGEN_RUNNING) || (!defined(RTCRITSECT_STRICT) && defined(IN_RING3) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT)))
    4141# define RTCRITSECT_STRICT
    4242#endif
     
    4646# define RTCRITSECT_STRICT_POS_ARGS             uId, RT_SRC_POS_ARGS
    4747# define RTCRITSECT_STRICT_BLOCK(hThread, pRec, fRecursive) \
    48                                                 RTThreadBlockingDebug((hThread), RTTHREADSTATE_CRITSECT, fRecursive, pRec, uId, RT_SRC_POS_ARGS)
     48                                                RTLockValidatorCheckBlocking(pRec, (hThread), RTTHREADSTATE_CRITSECT, fRecursive, uId, RT_SRC_POS_ARGS)
    4949#else
    5050# define RTCRITSECT_STRICT_POS_DECL             int iDummy
     
    5959 * Enables strictness checks and lock accounting of the RTSemMutex API.
    6060 */
    61 #if defined(DOXYGEN_RUNNING) || (!defined(RTSEMMUTEX_STRICT) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT)))
     61#if defined(DOXYGEN_RUNNING) || (!defined(RTSEMMUTEX_STRICT) && defined(IN_RING3) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT)))
    6262# define RTSEMMUTEX_STRICT
    6363#endif
     
    6666# define RTSEMMUTEX_STRICT_POS_DECL             RTHCUINTPTR uId, RT_SRC_POS_DECL
    6767# define RTSEMMUTEX_STRICT_POS_ARGS             uId, RT_SRC_POS_ARGS
    68 # define RTSEMMUTEX_STRICT_BLOCK(hThread, pRec) RTThreadBlockingDebug((hThread), RTTHREADSTATE_MUTEX, true, pRec, uId, RT_SRC_POS_ARGS)
     68# define RTSEMMUTEX_STRICT_BLOCK(hThread, pRec) RTLockValidatorCheckBlocking(pRec, (hThread), RTTHREADSTATE_MUTEX, true, uId, RT_SRC_POS_ARGS)
    6969#else
    7070# define RTSEMMUTEX_STRICT_POS_DECL             int iDummy
     
    7878 * Enables strictness checks and lock accounting of the RTSemRW API.
    7979 */
    80 #if defined(DOXYGEN_RUNNING) || (!defined(RTSEMRW_STRICT) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT)))
     80#if defined(DOXYGEN_RUNNING) || (!defined(RTSEMRW_STRICT) && defined(IN_RING3) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT)))
    8181# define RTSEMRW_STRICT
    8282#endif
  • trunk/src/VBox/Runtime/include/internal/thread.h

    r25368 r25406  
    3939# include <iprt/critsect.h>
    4040#endif
     41#include "internal/lockvalidator.h"
    4142#include "internal/magics.h"
    4243
     
    4748
    4849/** Max thread name length. */
    49 #define RTTHREAD_NAME_LEN 16
     50#define RTTHREAD_NAME_LEN       16
    5051#ifdef IPRT_WITH_GENERIC_TLS
    5152/** The number of TLS entries for the generic implementation. */
    52 # define RTTHREAD_TLS_ENTRIES 64
     53# define RTTHREAD_TLS_ENTRIES   64
    5354#endif
    5455
     
    9091    size_t                  cbStack;
    9192#ifdef IN_RING3
    92     /** What we're blocking on. */
    93     union RTTHREADINTBLOCKID
    94     {
    95         PRTLOCKVALIDATORREC pRec;
    96         uint64_t            u64;
    97     } Block;
    98     /** Where we're blocking. */
    99     const char volatile    *pszBlockFunction;
    100     /** Where we're blocking. */
    101     const char volatile    *pszBlockFile;
    102     /** Where we're blocking. */
    103     uint32_t volatile       uBlockLine;
    104     /** Where we're blocking. */
    105     RTHCUINTPTR volatile    uBlockId;
    106     /** Number of registered write locks, mutexes and critsects that this thread owns. */
    107     int32_t volatile        cWriteLocks;
    108     /** Number of registered read locks that this thread owns, nesting included. */
    109     int32_t volatile        cReadLocks;
     93    /** The lock validator data. */
     94    RTLOCKVALIDATORPERTHREAD LockValidator;
    11095#endif /* IN_RING3 */
    11196#ifdef IPRT_WITH_GENERIC_TLS
     
    209194#endif
    210195
     196/**
     197 * Gets the thread state.
     198 *
     199 * @returns The thread state.
     200 * @param   pThread             The thread.
     201 */
     202DECLINLINE(RTTHREADSTATE) rtThreadGetState(PRTTHREADINT pThread)
     203{
     204    return pThread->enmState;
     205}
     206
    211207RT_C_DECLS_END
    212208
Note: See TracChangeset for help on using the changeset viewer.

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