VirtualBox

Ignore:
Timestamp:
Apr 6, 2012 9:05:19 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
77321
Message:

RTSpinlock: Redid the interface, eliminating NoInts and Tmp. Whether a spinlock is interrupt safe or not is now defined at creation time, preventing stupid bugs arrising from calling the wrong acquire and/or release methods somewhere. The saved flags are stored in the spinlock strucutre, eliminating the annoying Tmp variable. Needs testing on each platform before fixing the build burn.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/os2/SUPDrv-os2.cpp

    r37249 r40806  
    108108             * Initialize the session hash table.
    109109             */
    110             rc = RTSpinlockCreate(&g_Spinlock);
     110            rc = RTSpinlockCreate(&g_Spinlock, RTSPINLOCK_FLAGS_INTERRUPT_SAFE, "VBoxDrvOS2");
    111111            if (RT_SUCCESS(rc))
    112112            {
     
    160160         */
    161161        unsigned iHash = SESSION_HASH(sfn);
    162         RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    163         RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     162        RTSpinlockAcquire(g_Spinlock);
    164163        pSession->pNextHash = g_apSessionHashTab[iHash];
    165164        g_apSessionHashTab[iHash] = pSession;
    166         RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     165        RTSpinlockReleaseNoInts(g_Spinlock);
    167166    }
    168167
     
    182181    const RTPROCESS Process = RTProcSelf();
    183182    const unsigned  iHash = SESSION_HASH(sfn);
    184     RTSPINLOCKTMP Tmp = RTSPINLOCKTMP_INITIALIZER;
    185     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     183    RTSpinlockAcquire(g_Spinlock);
    186184
    187185    pSession = g_apSessionHashTab[iHash];
     
    214212        }
    215213    }
    216     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     214    RTSpinlockReleaseNoInts(g_Spinlock);
    217215    if (!pSession)
    218216    {
     
    234232     * Find the session.
    235233     */
    236     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    237234    const RTPROCESS     Process = RTProcSelf();
    238235    const unsigned      iHash = SESSION_HASH(sfn);
    239236    PSUPDRVSESSION      pSession;
    240237
    241     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     238    RTSpinlockAcquire(g_Spinlock);
    242239    pSession = g_apSessionHashTab[iHash];
    243240    if (pSession && pSession->Process != Process)
     
    248245                     || pSession->Process != Process));
    249246    }
    250     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     247    RTSpinlockReleaseNoInts(g_Spinlock);
    251248    if (RT_UNLIKELY(!pSession))
    252249    {
     
    268265     * Find the session.
    269266     */
    270     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    271267    const RTPROCESS     Process = RTProcSelf();
    272268    const unsigned      iHash = SESSION_HASH(sfn);
    273269    PSUPDRVSESSION      pSession;
    274270
    275     RTSpinlockAcquireNoInts(g_Spinlock, &Tmp);
     271    RTSpinlockAcquire(g_Spinlock);
    276272    pSession = g_apSessionHashTab[iHash];
    277273    if (pSession && pSession->Process != Process)
     
    282278                     || pSession->Process != Process));
    283279    }
    284     RTSpinlockReleaseNoInts(g_Spinlock, &Tmp);
     280    RTSpinlockReleaseNoInts(g_Spinlock);
    285281    if (!pSession)
    286282    {
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