VirtualBox

Ignore:
Timestamp:
May 31, 2012 4:48:33 PM (13 years ago)
Author:
vboxsync
Message:

Main/HostUSBDevice(all platforms)+USBProxyService: redo USB locking, fixes major regression, added lots of assertions to catch locking flaws early, whitespace cleanup
Main/Machine: small USB locking fix to be consistent with the remaining code
Main/Host+glue/AutoLock: replace USB list lock by host lock, small numbering cleanup
Main/Console: redo USB locking, do less in USB callbacks/EMT (addresses long standing todo items), eliminate unsafe iterator parameters

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-server/HostImpl.cpp

    r41174 r41528  
    55
    66/*
    7  * Copyright (C) 2006-2011 Oracle Corporation
     7 * Copyright (C) 2004-2012 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    173173    Data()
    174174        :
    175 #ifdef VBOX_WITH_USB
    176           usbListsLock(LOCKCLASS_USBLIST),
    177 #endif
    178175          fDVDDrivesListBuilt(false),
    179176          fFloppyDrivesListBuilt(false)
     
    183180
    184181#ifdef VBOX_WITH_USB
    185     WriteLockHandle         usbListsLock;               // protects the below two lists
    186 
    187182    USBDeviceFilterList     llChildren;                 // all USB device filters
    188183    USBDeviceFilterList     llUSBDeviceFilters;         // USB device filters in use by the USB proxy service
     
    779774    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    780775
    781     AutoMultiWriteLock2 alock(this->lockHandle(), &m->usbListsLock COMMA_LOCKVAL_SRC_POS);
     776    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    782777
    783778    HRESULT rc = checkUSBProxyService();
     
    12291224    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    12301225
    1231     AutoMultiWriteLock2 alock(this->lockHandle(), &m->usbListsLock COMMA_LOCKVAL_SRC_POS);
     1226    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    12321227
    12331228    clearError();
     
    12911286    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    12921287
    1293     AutoMultiWriteLock2 alock(this->lockHandle(), &m->usbListsLock COMMA_LOCKVAL_SRC_POS);
     1288    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    12941289
    12951290    clearError();
     
    15681563    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    15691564
    1570     AutoMultiWriteLock2 alock(this->lockHandle(), &m->usbListsLock COMMA_LOCKVAL_SRC_POS);
     1565    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    15711566
    15721567    for (settings::USBDeviceFiltersList::const_iterator it = data.llUSBDeviceFilters.begin();
     
    16021597    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    16031598
    1604     AutoReadLock alock1(this COMMA_LOCKVAL_SRC_POS);
    1605     AutoReadLock alock2(&m->usbListsLock COMMA_LOCKVAL_SRC_POS);
     1599    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    16061600
    16071601    data.llUSBDeviceFilters.clear();
     
    20102004    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    20112005
    2012     AutoWriteLock alock(&m->usbListsLock COMMA_LOCKVAL_SRC_POS);
     2006    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    20132007
    20142008    m->llChildren.push_back(pChild);
     
    20222016    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    20232017
    2024     AutoWriteLock alock(&m->usbListsLock COMMA_LOCKVAL_SRC_POS);
     2018    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    20252019
    20262020    for (USBDeviceFilterList::iterator it = m->llChildren.begin();
     
    21022096void Host::getUSBFilters(Host::USBDeviceFilterList *aGlobalFilters)
    21032097{
    2104     AutoReadLock alock(&m->usbListsLock COMMA_LOCKVAL_SRC_POS);
     2098    AutoReadLock alock(this COMMA_LOCKVAL_SRC_POS);
    21052099
    21062100    *aGlobalFilters = m->llUSBDeviceFilters;
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