VirtualBox

Ignore:
Timestamp:
May 31, 2012 4:48:33 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
78291
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/solaris/USBProxyServiceSolaris.cpp

    r38016 r41528  
    55
    66/*
    7  * Copyright (C) 2006-2007 Oracle Corporation
     7 * Copyright (C) 2005-2012 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5454 * Initialize data members.
    5555 */
    56 USBProxyServiceSolaris::USBProxyServiceSolaris (Host *aHost)
    57     : USBProxyService (aHost), mUSBLibInitialized(false)
     56USBProxyServiceSolaris::USBProxyServiceSolaris(Host *aHost)
     57    : USBProxyService(aHost), mUSBLibInitialized(false)
    5858{
    5959    LogFlowThisFunc(("aHost=%p\n", aHost));
     
    337337     */
    338338    AssertReturn(aDevice, VERR_GENERAL_FAILURE);
     339    AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
     340
     341    AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
    339342    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
    340     AssertReturn(aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
     343
    341344    Assert(aDevice->getUnistate() == kHostUSBDeviceState_Capturing);
    342345    AssertReturn(aDevice->mUsb, VERR_INVALID_POINTER);
     
    372375void USBProxyServiceSolaris::captureDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess)
    373376{
     377    AssertReturnVoid(aDevice->isWriteLockOnCurrentThread());
    374378    /*
    375379     * Remove the one-shot filter if necessary.
     
    388392     */
    389393    AssertReturn(aDevice, VERR_GENERAL_FAILURE);
     394    AssertReturn(!aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
     395
     396    AutoReadLock devLock(aDevice COMMA_LOCKVAL_SRC_POS);
    390397    LogFlowThisFunc(("aDevice=%s\n", aDevice->getName().c_str()));
    391     AssertReturn(aDevice->isWriteLockOnCurrentThread(), VERR_GENERAL_FAILURE);
     398
    392399    Assert(aDevice->getUnistate() == kHostUSBDeviceState_ReleasingToHost);
    393400    AssertReturn(aDevice->mUsb, VERR_INVALID_POINTER);
     
    423430void USBProxyServiceSolaris::releaseDeviceCompleted(HostUSBDevice *aDevice, bool aSuccess)
    424431{
     432    AssertReturnVoid(aDevice->isWriteLockOnCurrentThread());
    425433    /*
    426434     * Remove the one-shot filter if necessary.
     
    435443bool USBProxyServiceSolaris::updateDeviceState(HostUSBDevice *aDevice, PUSBDEVICE aUSBDevice, bool *aRunFilters, SessionMachine **aIgnoreMachine)
    436444{
     445    AssertReturn(aDevice, false);
     446    AssertReturn(!aDevice->isWriteLockOnCurrentThread(), false)
    437447    return USBProxyService::updateDeviceState(aDevice, aUSBDevice, aRunFilters, aIgnoreMachine);
    438448}
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