VirtualBox

Changeset 6748 in vbox


Ignore:
Timestamp:
Feb 2, 2008 1:10:56 AM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
27830
Message:

Same assertion for request/release as in the event sem code. Document the 1-2ns gain because of predicition.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/r3/linux/semmutex-linux.cpp

    r6747 r6748  
    148148     */
    149149    struct RTSEMMUTEXINTERNAL *pThis = MutexSem;
    150     AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    151     AssertMsgReturn(pThis->iMagic == RTSEMMUTEX_MAGIC,
    152                     ("MutexSem=%p iMagic=%#x\n", pThis, pThis->iMagic),
    153                     VERR_INVALID_HANDLE);
     150    AssertReturn(VALID_PTR(pThis) && pThis->iMagic == RTSEMMUTEX_MAGIC,
     151                 VERR_INVALID_HANDLE);
    154152
    155153    /*
     
    178176    /*
    179177     * Lock the mutex.
     178     * Optimize for the uncontended case (makes 1-2 ns difference).
    180179     */
    181180    if (RT_UNLIKELY(!ASMAtomicCmpXchgS32(&pThis->iState, 1, 0)))
     
    225224        /*
    226225         * When leaving this loop, iState is set to 2. This means that we gained the
    227          * Lock and there are _possibly_ some waiters. We don't know exactly as another
     226         * lock and there are _possibly_ some waiters. We don't know exactly as another
    228227         * thread might entered this loop at nearly the same time. Therefore we will
    229228         * call futex_wakeup once too often (if _no_ other thread entered this loop).
     
    262261     */
    263262    struct RTSEMMUTEXINTERNAL *pThis = MutexSem;
    264     AssertPtrReturn(pThis, VERR_INVALID_HANDLE);
    265     AssertMsgReturn(pThis->iMagic == RTSEMMUTEX_MAGIC,
    266                     ("MutexSem=%p iMagic=%#x\n", pThis, pThis->iMagic),
    267                     VERR_INVALID_HANDLE);
     263    AssertReturn(VALID_PTR(pThis) && pThis->iMagic == RTSEMMUTEX_MAGIC,
     264                 VERR_INVALID_HANDLE);
    268265
    269266    /*
     
    298295     */
    299296    int32_t iNew = ASMAtomicDecS32(&pThis->iState);
    300     if (iNew != 0)
     297    if (RT_UNLIKELY(iNew != 0))
    301298    {
    302299        /* somebody is waiting, try wake up one of them. */
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