VirtualBox

Changeset 20089 in vbox for trunk/src/VBox/VMM/VMMAll


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

TM: The critsect assertions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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