VirtualBox

Changeset 8321 in vbox


Ignore:
Timestamp:
Apr 23, 2008 9:53:40 AM (17 years ago)
Author:
vboxsync
Message:

Main/AutoLock: Use RTThreadNativeSelf() instead of RTThredSelf() which currently returns NIL_RTTHREAD for alien threads.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/AutoLock.cpp

    r8155 r8321  
    4343    AssertRC (vrc);
    4444
    45     mWriteLockThread = NIL_RTTHREAD;
     45    mWriteLockThread = NIL_RTNATIVETHREAD;
    4646
    4747    mReadLockCount = 0;
     
    7676
    7777    RTCritSectEnter (&mCritSect);
    78     bool locked = mWriteLockThread == RTThreadSelf();
     78    bool locked = mWriteLockThread == RTThreadNativeSelf();
    7979    RTCritSectLeave (&mCritSect);
    8080    return locked;
     
    9494    RTCritSectEnter (&mCritSect);
    9595
    96     if (mWriteLockThread != RTThreadSelf())
    97     {
    98         if (mReadLockCount != 0 || mWriteLockThread != NIL_RTTHREAD ||
     96    if (mWriteLockThread != RTThreadNativeSelf())
     97    {
     98        if (mReadLockCount != 0 || mWriteLockThread != NIL_RTNATIVETHREAD ||
    9999            mWriteLockPending != 0 /* respect other pending writers */)
    100100        {
     
    109109
    110110        Assert (mWriteLockLevel == 0);
    111         Assert (mWriteLockThread == NIL_RTTHREAD);
    112 
    113         mWriteLockThread = RTThreadSelf();
     111        Assert (mWriteLockThread == NIL_RTNATIVETHREAD);
     112
     113        mWriteLockThread = RTThreadNativeSelf();
    114114    }
    115115
     
    139139        if (mWriteLockLevel == 0)
    140140        {
    141             mWriteLockThread = NIL_RTTHREAD;
     141            mWriteLockThread = NIL_RTNATIVETHREAD;
    142142
    143143            /* no write locks, let writers go if there are any (top priority),
     
    172172    bool isFirstReadLock = mReadLockCount == 1;
    173173
    174     if (isWriteLock && mWriteLockThread == RTThreadSelf())
     174    if (isWriteLock && mWriteLockThread == RTThreadNativeSelf())
    175175    {
    176176        /* read lock nested into the write lock, cause return immediately */
     
    225225            /* read unlock nested into the write lock, just decrease the
    226226             * counter */
    227             Assert (mWriteLockThread == RTThreadSelf()
     227            Assert (mWriteLockThread == RTThreadNativeSelf()
    228228                    /* unlockRead() after lockWrite()? */);
    229             if (mWriteLockThread == RTThreadSelf())
     229            if (mWriteLockThread == RTThreadNativeSelf())
    230230                -- mReadLockCount;
    231231        }
  • trunk/src/VBox/Main/include/AutoLock.h

    r8155 r8321  
    191191    RTSEMEVENTMULTI mGoReadSem;
    192192
    193     RTTHREAD mWriteLockThread;
     193    RTNATIVETHREAD mWriteLockThread;
    194194
    195195    uint32_t mReadLockCount;
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