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/Runtime/common/misc/handletable.cpp

    r33540 r40806  
    103103    if (fFlags & RTHANDLETABLE_FLAGS_LOCKED)
    104104    {
    105         int rc = RTSpinlockCreate(&pThis->hSpinlock);
     105        int rc = RTSpinlockCreate(&pThis->hSpinlock, RTSPINLOCK_FLAGS_INTERRUPT_UNSAFE, "RTHandleTableCreateEx");
    106106        if (RT_FAILURE(rc))
    107107        {
     
    127127{
    128128    PRTHANDLETABLEINT   pThis;
    129     RTSPINLOCKTMP       Tmp = RTSPINLOCKTMP_INITIALIZER;
    130129    uint32_t            i1;
    131130    uint32_t            i;
     
    145144     * Then kill the lock.
    146145     */
    147     rtHandleTableLock(pThis, &Tmp);
     146    rtHandleTableLock(pThis);
    148147    ASMAtomicWriteU32(&pThis->u32Magic, ~RTHANDLETABLE_MAGIC);
    149     rtHandleTableUnlock(pThis, &Tmp);
     148    rtHandleTableUnlock(pThis);
    150149
    151150    if (pThis->hSpinlock != NIL_RTSPINLOCK)
    152151    {
    153         rtHandleTableLock(pThis, &Tmp);
    154         rtHandleTableUnlock(pThis, &Tmp);
     152        rtHandleTableLock(pThis);
     153        rtHandleTableUnlock(pThis);
    155154
    156155        RTSpinlockDestroy(pThis->hSpinlock);
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