VirtualBox

Changeset 20089 in vbox for trunk


Ignore:
Timestamp:
May 27, 2009 2:53:47 PM (16 years ago)
Author:
vboxsync
Message:

TM: The critsect assertions.

Location:
trunk/src/VBox/VMM
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/VMM/TM.cpp

    r20087 r20089  
    13771377    bool            fActive  = false;
    13781378    bool            fPending = false;
     1379
     1380    AssertMsg(   !pTimer->pCritSect
     1381              || VMR3GetState(pVM) != VMSTATE_RUNNING
     1382              || PDMCritSectIsOwner(pTimer->pCritSect), ("%s\n", pTimer->pszDesc));
    13791383
    13801384    /*
     
    23262330 *
    23272331 * In strict builds, ownership of the critical section will be asserted by
    2328  * TMTimerSet and TMTimerStop.
     2332 * TMTimerSet, TMTimerStop, TMTimerGetExpire and TMTimerDestroy (when called at
     2333 * runtime).
    23292334 *
    23302335 * @retval  VINF_SUCCESS on success.
  • trunk/src/VBox/VMM/VMMAll/TMAll.cpp

    r20050 r20089  
    4242#ifdef IN_RING3
    4343# include <iprt/thread.h>
     44#endif
     45
     46
     47/*******************************************************************************
     48*   Defined Constants And Macros                                               *
     49*******************************************************************************/
     50/** @def TMTIMER_ASSERT_CRITSECT
     51 * Checks that the caller owns the critical section if one is associated with
     52 * the timer. */
     53#ifdef VBOX_STRICT
     54# define TMTIMER_ASSERT_CRITSECT(pTimer) \
     55    do { \
     56        if ((pTimer)->pCritSect) \
     57        { \
     58            PPDMCRITSECT pCritSect = (PPDMCRITSECT)MMHyperR3ToCC((pTimer)->CTX_SUFF(pVM), (pTimer)->pCritSect); \
     59            Assert(pCritSect && PDMCritSectIsOwner(pCritSect)); \
     60        } \
     61    } while (0)
     62#else
     63# define TMTIMER_ASSERT_CRITSECT(pTimer) do { } while (0)
    4464#endif
    4565
     
    731751{
    732752    STAM_PROFILE_START(&pTimer->CTX_SUFF(pVM)->tm.s.CTXALLSUFF(StatTimerSet), a);
     753    TMTIMER_ASSERT_CRITSECT(pTimer);
    733754
    734755    /** @todo find the most frequently used paths and make them skip tmSchedule and tmTimerTryWithLink. */
     
    942963{
    943964    STAM_PROFILE_START(&pTimer->CTX_SUFF(pVM)->tm.s.CTXALLSUFF(StatTimerStop), a);
     965    TMTIMER_ASSERT_CRITSECT(pTimer);
     966
    944967    /** @todo see if this function needs optimizing. */
    945968    int cRetries = 1000;
     
    13261349VMMDECL(uint64_t) TMTimerGetExpire(PTMTIMER pTimer)
    13271350{
     1351    TMTIMER_ASSERT_CRITSECT(pTimer);
    13281352    int cRetries = 1000;
    13291353    do
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