VirtualBox

Changeset 36521 in vbox for trunk


Ignore:
Timestamp:
Apr 4, 2011 12:24:23 PM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70942
Message:

iprt/cpp/lock.h: RTLock, RTLockMtx -> RTCLock, RTClockMtx. 'RTC' is now the official C++ class prefix for IPRT.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/cpp/lock.h

    r36508 r36521  
    11/** @file
    2  * IPRT - RTLock Classes for Scope-based Locking.
     2 * IPRT - Classes for Scope-based Locking.
    33 */
    44
     
    3939 */
    4040
    41 class RTLock;
     41class RTCLock;
    4242
    4343/**
     
    4848 * a global variable, for class wide purposes.
    4949 *
    50  * This is best used together with RTLock.
     50 * This is best used together with RTCLock.
    5151 */
    52 class RTLockMtx
     52class RTCLockMtx
    5353{
    54 friend class RTLock;
     54friend class RTCLock;
    5555
    5656private:
     
    5858
    5959public:
    60     RTLockMtx()
     60    RTCLockMtx()
    6161    {
    6262#ifdef RT_LOCK_STRICT_ORDER
     
    7070
    7171    /** Use to when creating locks that belongs in the same "class".  */
    72     RTLockMtx(RT_SRC_POS_DECL, uint32_t uSubClass = RTLOCKVAL_SUB_CLASS_NONE)
     72    RTCLockMtx(RT_SRC_POS_DECL, uint32_t uSubClass = RTLOCKVAL_SUB_CLASS_NONE)
    7373    {
    7474#ifdef RT_LOCK_STRICT_ORDER
     
    8383    }
    8484
    85     ~RTLockMtx()
     85    ~RTCLockMtx()
    8686    {
    8787        RTCritSectDelete(&mMtx);
    8888    }
    8989
    90 // lock() and unlock() are private so that only
    91 // friend RTLock can access them
     90    /* lock() and unlock() are private so that only friend RTCLock can access
     91       them. */
    9292private:
    9393    inline void lock()
     
    106106 * The stack object for automatic locking and unlocking.
    107107 *
    108  * This is a helper class for automatic locks, to simplify
    109  * requesting a RTLockMtx and to not forget releasing it.
    110  * To request a RTLockMtx, simply create an instance of RTLock
    111  * on the stack and pass the mutex to it:
     108 * This is a helper class for automatic locks, to simplify requesting a
     109 * RTCLockMtx and to not forget releasing it.  To request a RTCLockMtx, simply
     110 * create an instance of RTCLock on the stack and pass the mutex to it:
    112111 *
    113112 * @code
    114     extern RTLockMtx gMtx;     // wherever this is
     113    extern RTCLockMtx gMtx;     // wherever this is
    115114    ...
    116115    if (...)
    117116    {
    118         RTLock lock(gMtx);
     117        RTCLock lock(gMtx);
    119118        ... // do stuff
    120119        // when lock goes out of scope, destructor releases the mutex
     
    122121   @endcode
    123122 *
    124  * You can also explicitly release the mutex by calling RTLock::release().
     123 * You can also explicitly release the mutex by calling RTCLock::release().
    125124 * This might be helpful if the lock doesn't go out of scope early enough
    126125 * for your mutex to be released.
    127126 */
    128 class RTLock
     127class RTCLock
    129128{
    130129private:
    131     RTLockMtx  &mMtx;
     130    RTCLockMtx &m_rMtx;
    132131    bool        mfLocked;
    133132
    134133public:
    135     RTLock(RTLockMtx &aMtx)
    136         : mMtx(aMtx)
     134    RTCLock(RTCLockMtx &a_rMtx)
     135        : m_rMtx(a_rMtx)
    137136    {
    138         mMtx.lock();
     137        m_rMtx.lock();
    139138        mfLocked = true;
    140139    }
    141140
    142     ~RTLock()
     141    ~RTCLock()
    143142    {
    144143        if (mfLocked)
    145             mMtx.unlock();
     144            m_rMtx.unlock();
    146145    }
    147146
     
    150149        if (mfLocked)
    151150        {
    152             mMtx.unlock();
     151            m_rMtx.unlock();
    153152            mfLocked = false;
    154153        }
  • trunk/src/VBox/Main/xml/Makefile.kup

    • Property svn:eol-style set to native
    • Property svn:keywords set to Author Date Id Revision
  • trunk/src/VBox/Main/xml/Settings.cpp

    r36405 r36521  
    694694            med.strFormat = "RAW";
    695695        }
    696    
     696
    697697        if (t == DVDImage)
    698698            med.hdType = MediumType_Readonly;
     
    44594459#elif defined(RT_OS_LINUX)
    44604460    // on Linux, we need to check at runtime what's actually supported...
    4461     static RTLockMtx s_mtx;
     4461    static RTCLockMtx s_mtx;
    44624462    static AudioDriverType_T s_linuxDriver = -1;
    4463     RTLock lock(s_mtx);
     4463    RTCLock lock(s_mtx);
    44644464    if (s_linuxDriver == (AudioDriverType_T)-1)
    44654465    {
     
    44734473# if defined(VBOX_WITH_ALSA)
    44744474            /* Check if we can load the ALSA library */
    4475             if (RTLdrIsLoadable("libasound.so.2"))
     4475             if (RTLdrIsLoadable("libasound.so.2"))
    44764476                s_linuxDriver = AudioDriverType_ALSA;
    4477        else
     4477        else
    44784478# endif /* VBOX_WITH_ALSA */
    44794479            s_linuxDriver = AudioDriverType_OSS;
  • trunk/src/VBox/Runtime/r3/xml.cpp

    r36405 r36521  
    9191        /** Used to provide some thread safety missing in libxml2 (see e.g.
    9292         *  XmlTreeBackend::read()) */
    93         RTLockMtx lock;
     93        RTCLockMtx lock;
    9494    }
    9595    sxml;  /* XXX naming this xml will break with gcc-3.3 */
     
    387387{
    388388    PFNEXTERNALENTITYLOADER pOldLoader;
    389     RTLock lock;
     389    RTCLock lock;
    390390
    391391    Data()
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