VirtualBox

Changeset 55958 in vbox


Ignore:
Timestamp:
May 20, 2015 12:33:40 AM (10 years ago)
Author:
vboxsync
Message:

VirtualBoxBase.cpp: One more RT_UNLIKELY in lockHandle().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-all/VirtualBoxBase.cpp

    r55582 r55958  
    7575{
    7676    /* lazy initialization */
    77     if (RT_UNLIKELY(!mObjectLock))
    78     {
    79         AssertCompile(sizeof(RWLockHandle *) == sizeof(void *));
    80 
    81         // getLockingClass() is overridden by many subclasses to return
    82         // one of the locking classes listed at the top of AutoLock.h
    83         RWLockHandle *objLock = new RWLockHandle(getLockingClass());
    84         if (!ASMAtomicCmpXchgPtr(&mObjectLock, objLock, NULL))
    85         {
    86             delete objLock;
    87             objLock = ASMAtomicReadPtrT(&mObjectLock, RWLockHandle *);
    88         }
    89         return objLock;
    90     }
    91     return mObjectLock;
     77    if (RT_LIKELY(mObjectLock))
     78        return mObjectLock;
     79
     80    AssertCompile(sizeof(RWLockHandle *) == sizeof(void *));
     81
     82    // getLockingClass() is overridden by many subclasses to return
     83    // one of the locking classes listed at the top of AutoLock.h
     84    RWLockHandle *objLock = new RWLockHandle(getLockingClass());
     85    if (!ASMAtomicCmpXchgPtr(&mObjectLock, objLock, NULL))
     86    {
     87        delete objLock;
     88        objLock = ASMAtomicReadPtrT(&mObjectLock, RWLockHandle *);
     89    }
     90    return objLock;
    9291}
    9392
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