VirtualBox

Changeset 36068 in vbox


Ignore:
Timestamp:
Feb 24, 2011 10:04:44 AM (14 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
70188
Message:

VBoxUSBMon.sys: initialize RemoveLock once.

Location:
trunk/src/VBox/HostDrivers/VBoxUSB/win/Monitor
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/Monitor/USBMon.cpp

    r31898 r36068  
    313313        }
    314314
    315         //
    316         // Let us use remove lock to keep count of IRPs so that we don't
    317         // detach and delete our deviceobject until all pending I/Os in our
    318         // devstack are completed. Remlock is required to protect us from
    319         // various race conditions where our driver can get unloaded while we
    320         // are still running dispatch or completion code.
    321         //
    322 
    323         IoInitializeRemoveLock (&pDevExt->RemoveLock , POOL_TAG,
    324                                 1,      // MaxLockedMinutes
    325                                 100);   // HighWatermark, this parameter is
    326                                         // used only on checked build. Specifies
    327                                         // the maximum number of outstanding
    328                                         // acquisitions allowed on the lock
    329 
    330         DebugPrint(("VBoxUSBMon: remove lock = %x\n", pDevExt->RemoveLock.Common.RemoveEvent));
     315        if (InterlockedCompareExchange(&pDevExt->fRemoveLockInitialized, 1, 0))
     316        {
     317            //
     318            // Let us use remove lock to keep count of IRPs so that we don't
     319            // detach and delete our deviceobject until all pending I/Os in our
     320            // devstack are completed. Remlock is required to protect us from
     321            // various race conditions where our driver can get unloaded while we
     322            // are still running dispatch or completion code.
     323            //
     324
     325            IoInitializeRemoveLock (&pDevExt->RemoveLock , POOL_TAG,
     326                                    1,      // MaxLockedMinutes
     327                                    100);   // HighWatermark, this parameter is
     328                                            // used only on checked build. Specifies
     329                                            // the maximum number of outstanding
     330                                            // acquisitions allowed on the lock
     331
     332            DebugPrint(("VBoxUSBMon: remove lock = %x\n", pDevExt->RemoveLock.Common.RemoveEvent));
     333        }
    331334    }
    332335
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/Monitor/USBMon.h

    r31896 r36068  
    8383    IO_REMOVE_LOCK      RemoveLock;
    8484
     85    /* Whether the lock has been initialized. */
     86    LONG                fRemoveLockInitialized;
    8587
    8688    /* Number of times the device was opened. */
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