VirtualBox

Changeset 8651 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
May 7, 2008 12:16:29 PM (17 years ago)
Author:
vboxsync
Message:

Moved the strictness indicators into internal/strict.h.

Location:
trunk/src/VBox/Runtime
Files:
4 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/generic/critsect-generic.cpp

    r8650 r8651  
    3939#include <iprt/err.h>
    4040#include "internal/thread.h"
    41 
    42 /** @def RTCRITSECT_STRICT
    43  * Define this to enable deadlock detection.
    44  */
    45 #if !defined(RTCRITSECT_STRICT) && defined(RT_STRICT)
    46 # define RTCRITSECT_STRICT
    47 #endif
     41#include "internal/strict.h"
     42
    4843
    4944/* in strict mode we're redefining this, so undefine it now for the implementation. */
  • trunk/src/VBox/Runtime/include/internal/strict.h

    r8626 r8651  
    11/* $Id$ */
    22/** @file
    3  * IPRT - Internal Header Defining The Magic Numbers.
     3 * IPRT - Internal Header Defining Strictness Indicators.
    44 */
    55
     
    2929 */
    3030
    31 #ifndef ___internal_magics_h
    32 #define ___internal_magics_h
     31#ifndef ___internal_strict_h
     32#define ___internal_strict_h
    3333
    34 /** @name Magic Numbers.
     34/** @name Strictness Indicators
    3535 * @{ */
    3636
    37 /** The value of RTENVINTERNAL::u32Magic. (Rumiko Takahashi) */
    38 #define RTENV_MAGIC                 0x19571010
    39 /** The value of RTDIR::u32Magic. (Michael Ende) */
    40 #define RTDIR_MAGIC                 0x19291112
    41 /** The value of RTDIR::u32Magic after RTDirClose().  */
    42 #define RTDIR_MAGIC_DEAD            0x19950829
    43 /** Magic number for RTHEAPSIMPLEINTERNAL::u32Magic. (Kyoichi Katayama) */
    44 #define RTHEAPSIMPLE_MAGIC          0x19590105
    45 /** The magic value for RTLDRMODINTERNAL::u32Magic. (Alan Moore) */
    46 #define RTLDRMOD_MAGIC              0x19531118
    47 /** Magic number for heap blocks. (Edgar Allan Poe) */
    48 #define RTMEMHDR_MAGIC              0x18090119
    49 /** RTR0MEMOBJ::u32Magic. (Masakazu Katsura) */
    50 #define RTR0MEMOBJ_MAGIC            0x19611210
    51 /** Magic for the event semaphore structure. (Neil Gaiman) */
    52 #define RTSEMEVENT_MAGIC            0x19601110
    53 /** Magic for the multiple release event semaphore structure. (Isaac Asimov) */
    54 #define RTSEMEVENTMULTI_MAGIC       0x19200102
    55 /** Magic value for RTSEMFASTMUTEXINTERNAL::u32Magic. (John Ronald Reuel Tolkien) */
    56 #define RTSEMFASTMUTEX_MAGIC        0x18920102
    57 /** Dead magic value for RTSEMFASTMUTEXINTERNAL::u32Magic. */
    58 #define RTSEMFASTMUTEX_MAGIC_DEAD   0x19730902
    59 /** Magic for the mutex semaphore structure. (Douglas Adams) */
    60 #define RTSEMMUTEX_MAGIC            0x19520311
    61 /** Dead magic for the mutex semaphore structure. */
    62 #define RTSEMMUTEX_MAGIC_DEAD       0x20010511
    63 /** RTSEMRWINTERNAL::u32Magic value. (Kosuke Fujishima) */
    64 #define RTSEMRW_MAGIC               0x19640707
    65 /** Magic value for RTSPINLOCKINTERNAL::u32Magic. (Terry Pratchett) */
    66 #define RTSPINLOCK_MAGIC            0x19480428
    67 /** The value of RTSTREAM::u32Magic for a valid stream. */
    68 #define RTSTREAM_MAGIC              0xe44e44ee
    69 /** RTTHREADINT::u32Magic value. (Gilbert Keith Chesterton) */
    70 #define RTTHREADINT_MAGIC           0x18740529
    71 /** RTTHREADINT::u32Magic value for a dead thread. */
    72 #define RTTHREADINT_MAGIC_DEAD      0x19360614
    73 /** Magic number for timer handles. (Jared Mason Diamond) */
    74 #define RTTIMER_MAGIC               0x19370910
     37/** @def RTCRITSECT_STRICT
     38 * Enables strictness checks and lock accounting of the RTCritSect API.
     39 */
     40#if defined(DOXYGEN_RUNNING) || (!defined(RTCRITSECT_STRICT) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT)))
     41# define RTCRITSECT_STRICT
     42#endif
     43
     44/** @def RTSEMMUTEX_STRICT
     45 * Enables strictness checks and lock accounting of the RTSemMutex API.
     46 */
     47#if defined(DOXYGEN_RUNNING) || (!defined(RTSEMMUTEX_STRICT) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT)))
     48# define RTSEMMUTEX_STRICT
     49#endif
     50
     51/** @def RTSEMRW_STRICT
     52 * Enables strictness checks and lock accounting of the RTSemRW API.
     53 */
     54#if defined(DOXYGEN_RUNNING) || (!defined(RTSEMRW_STRICT) && (defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT)))
     55# define RTSEMRW_STRICT
     56#endif
     57
    7558
    7659/** @} */
  • trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp

    r8245 r8651  
    3535#include <iprt/assert.h>
    3636#include <iprt/alloc.h>
     37#include <iprt/thread.h>
    3738#include <iprt/asm.h>
    3839#include <iprt/err.h>
    3940#include "internal/magics.h"
     41#include "internal/strict.h"
    4042
    4143#include <errno.h>
     
    241243    pThis->Owner = Self;
    242244    ASMAtomicXchgU32(&pThis->cNesting, 1);
     245#ifdef RTSEMMUTEX_STRICT
     246    RTTHREAD Thread = RTThreadSelf();
     247    if (Thread != NIL_RTTHREAD)
     248        RTThreadWriteLockInc(Thread);
     249#endif
    243250    return VINF_SUCCESS;
    244251}
     
    292299     * Clear the state. (cNesting == 1)
    293300     */
     301#ifdef RTSEMMUTEX_STRICT
     302    RTTHREAD Thread = RTThreadSelf();
     303    if (Thread != NIL_RTTHREAD)
     304        RTThreadWriteLockDec(Thread);
     305#endif
    294306    pThis->Owner = (pthread_t)~0;
    295307    ASMAtomicXchgU32(&pThis->cNesting, 0);
  • trunk/src/VBox/Runtime/r3/posix/semmutex-posix.cpp

    r8649 r8651  
    3838#include <iprt/asm.h>
    3939#include <iprt/err.h>
     40#include "internal/strict.h"
    4041
    4142#include <errno.h>
     
    4344#include <unistd.h>
    4445#include <sys/time.h>
    45 
    46 
    47 /*******************************************************************************
    48 *   Defined Constants And Macros                                               *
    49 *******************************************************************************/
    50 /** @def RTSEMMUTEX_STRICT
    51  * Enables strictness checks and lock accounting.
    52  */
    53 #ifndef RTSEMMUTEX_STRICT
    54 # if defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT) || defined(DOXYGEN_RUNNING)
    55 #  define RTSEMMUTEX_STRICT
    56 # endif
    57 #endif
    5846
    5947
  • trunk/src/VBox/Runtime/r3/win/sems-win.cpp

    r8649 r8651  
    4040#include <iprt/assert.h>
    4141#include <iprt/err.h>
     42#include "internal/strict.h"
    4243
    4344
     
    4546*   Defined Constants And Macros                                               *
    4647*******************************************************************************/
    47 /** @def RTSEMMUTEX_STRICT
    48  * Enables strictness checks and lock accounting.
    49  */
    50 #ifndef RTSEMMUTEX_STRICT
    51 # if defined(RT_STRICT) || defined(RT_LOCK_STRICT) || defined(RTSEM_STRICT) || defined(DOXYGEN_RUNNING)
    52 #  define RTSEMMUTEX_STRICT
    53 # endif
    54 #endif
    55 
    5648/** Converts semaphore to win32 handle. */
    5749#define SEM2HND(Sem) ((HANDLE)(uintptr_t)Sem)
     
    290282}
    291283
    292 
    293 
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