VirtualBox

Changeset 8083 in vbox for trunk/src/VBox/Main


Ignore:
Timestamp:
Apr 17, 2008 9:12:12 AM (17 years ago)
Author:
vboxsync
Message:

Main: Renamed AutoLock => AutoWriteLock; AutoReaderLock => AutoReadLock.

Location:
trunk/src/VBox/Main
Files:
48 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/AudioAdapterImpl.cpp

    r7992 r8083  
    9292    AssertComRCReturnRC (thatCaller.rc());
    9393
    94     AutoReaderLock thatLock (aThat);
     94    AutoReadLock thatLock (aThat);
    9595    mData.share (aThat->mData);
    9696
     
    124124    AssertComRCReturnRC (thatCaller.rc());
    125125
    126     AutoReaderLock thatLock (aThat);
     126    AutoReadLock thatLock (aThat);
    127127    mData.attachCopy (aThat->mData);
    128128
     
    163163    CheckComRCReturnRC (autoCaller.rc());
    164164
    165     AutoReaderLock alock (this);
     165    AutoReadLock alock (this);
    166166
    167167    *aEnabled = mData->mEnabled;
     
    179179    CheckComRCReturnRC (adep.rc());
    180180
    181     AutoLock alock (this);
     181    AutoWriteLock alock (this);
    182182
    183183    if (mData->mEnabled != aEnabled)
     
    198198    CheckComRCReturnRC (autoCaller.rc());
    199199
    200     AutoReaderLock alock (this);
     200    AutoReadLock alock (this);
    201201
    202202    *aAudioDriver = mData->mAudioDriver;
     
    214214    CheckComRCReturnRC (adep.rc());
    215215
    216     AutoLock alock (this);
     216    AutoWriteLock alock (this);
    217217
    218218    HRESULT rc = S_OK;
     
    276276    CheckComRCReturnRC (autoCaller.rc());
    277277
    278     AutoReaderLock alock (this);
     278    AutoReadLock alock (this);
    279279
    280280    *aAudioController = mData->mAudioController;
     
    292292    CheckComRCReturnRC (adep.rc());
    293293
    294     AutoLock alock (this);
     294    AutoWriteLock alock (this);
    295295
    296296    HRESULT rc = S_OK;
     
    344344    AssertComRCReturnRC (autoCaller.rc());
    345345
    346     AutoLock alock (this);
     346    AutoWriteLock alock (this);
    347347
    348348    /* Note: we assume that the default values for attributes of optional
     
    438438    AssertComRCReturnRC (autoCaller.rc());
    439439
    440     AutoReaderLock alock (this);
     440    AutoReadLock alock (this);
    441441
    442442    Key node = aMachineNode.createKey ("AudioAdapter");
     
    543543    AssertComRCReturn (autoCaller.rc(), false);
    544544
    545     AutoLock alock (this);
     545    AutoWriteLock alock (this);
    546546
    547547    bool changed = false;
  • trunk/src/VBox/Main/AutoLock.cpp

    r8019 r8083  
    11/** @file
    22 *
    3  * AutoLock: smart critical section wrapper
     3 * AutoWriteLock/AutoReadLock: smart R/W semaphore wrappers
    44 */
    55
     
    4343}
    4444
    45 bool RWLockHandle::isLockedOnCurrentThread() const
     45bool RWLockHandle::isWriteLockOnCurrentThread() const
    4646{
    4747    RTCritSectEnter (&mCritSect);
  • trunk/src/VBox/Main/BIOSSettingsImpl.cpp

    r7466 r8083  
    8686    mPeer = that;
    8787
    88     AutoLock thatlock (that);
     88    AutoWriteLock thatlock (that);
    8989    mData.share (that->mData);
    9090
     
    114114    // mPeer is left null
    115115
    116     AutoLock thatlock (that);
     116    AutoWriteLock thatlock (that);
    117117    mData.attachCopy (that->mData);
    118118
     
    155155    CheckComRCReturnRC (autoCaller.rc());
    156156
    157     AutoReaderLock alock (this);
     157    AutoReadLock alock (this);
    158158
    159159    *enabled = mData->mLogoFadeIn;
     
    171171    CheckComRCReturnRC (adep.rc());
    172172
    173     AutoLock alock (this);
     173    AutoWriteLock alock (this);
    174174
    175175    mData.backup();
     
    187187    CheckComRCReturnRC (autoCaller.rc());
    188188
    189     AutoReaderLock alock (this);
     189    AutoReadLock alock (this);
    190190
    191191    *enabled = mData->mLogoFadeOut;
     
    203203    CheckComRCReturnRC (adep.rc());
    204204
    205     AutoLock alock (this);
     205    AutoWriteLock alock (this);
    206206
    207207    mData.backup();
     
    219219    CheckComRCReturnRC (autoCaller.rc());
    220220
    221     AutoReaderLock alock (this);
     221    AutoReadLock alock (this);
    222222
    223223    *displayTime = mData->mLogoDisplayTime;
     
    235235    CheckComRCReturnRC (adep.rc());
    236236
    237     AutoLock alock (this);
     237    AutoWriteLock alock (this);
    238238
    239239    mData.backup();
     
    251251    CheckComRCReturnRC (autoCaller.rc());
    252252
    253     AutoReaderLock alock (this);
     253    AutoReadLock alock (this);
    254254
    255255    mData->mLogoImagePath.cloneTo(imagePath);
     
    270270    CheckComRCReturnRC (adep.rc());
    271271
    272     AutoLock alock (this);
     272    AutoWriteLock alock (this);
    273273
    274274    mData.backup();
     
    286286    CheckComRCReturnRC (autoCaller.rc());
    287287
    288     AutoReaderLock alock (this);
     288    AutoReadLock alock (this);
    289289
    290290    *bootMenuMode = mData->mBootMenuMode;
     
    301301    CheckComRCReturnRC (adep.rc());
    302302
    303     AutoLock alock (this);
     303    AutoWriteLock alock (this);
    304304
    305305    mData.backup();
     
    317317    CheckComRCReturnRC (autoCaller.rc());
    318318
    319     AutoReaderLock alock (this);
     319    AutoReadLock alock (this);
    320320
    321321    *enabled = mData->mACPIEnabled;
     
    333333    CheckComRCReturnRC (adep.rc());
    334334
    335     AutoLock alock (this);
     335    AutoWriteLock alock (this);
    336336
    337337    mData.backup();
     
    349349    CheckComRCReturnRC (autoCaller.rc());
    350350
    351     AutoReaderLock alock (this);
     351    AutoReadLock alock (this);
    352352
    353353    *enabled = mData->mIOAPICEnabled;
     
    365365    CheckComRCReturnRC (adep.rc());
    366366
    367     AutoLock alock (this);
     367    AutoWriteLock alock (this);
    368368
    369369    mData.backup();
     
    381381    CheckComRCReturnRC (autoCaller.rc());
    382382
    383     AutoReaderLock alock (this);
     383    AutoReadLock alock (this);
    384384
    385385    *enabled = mData->mPXEDebugEnabled;
     
    397397    CheckComRCReturnRC (adep.rc());
    398398
    399     AutoLock alock (this);
     399    AutoWriteLock alock (this);
    400400
    401401    mData.backup();
     
    413413    CheckComRCReturnRC (autoCaller.rc());
    414414
    415     AutoReaderLock alock (this);
     415    AutoReadLock alock (this);
    416416
    417417    *aControllerType = mData->mIDEControllerType;
     
    429429    CheckComRCReturnRC (adep.rc());
    430430
    431     AutoLock alock (this);
     431    AutoWriteLock alock (this);
    432432
    433433    /* make sure the value is allowed */
     
    458458    CheckComRCReturnRC (autoCaller.rc());
    459459
    460     AutoReaderLock alock (this);
     460    AutoReadLock alock (this);
    461461
    462462    *offset = mData->mTimeOffset;
     
    474474    CheckComRCReturnRC (adep.rc());
    475475
    476     AutoLock alock (this);
     476    AutoWriteLock alock (this);
    477477
    478478    mData.backup();
     
    506506    AssertComRCReturnRC (autoCaller.rc());
    507507
    508     AutoLock alock (this);
     508    AutoWriteLock alock (this);
    509509
    510510    /* Note: we assume that the default values for attributes of optional
     
    620620    AssertComRCReturnRC (autoCaller.rc());
    621621
    622     AutoReaderLock alock (this);
     622    AutoReadLock alock (this);
    623623
    624624    Key biosNode = aMachineNode.createKey ("BIOS");
     
    705705void BIOSSettings::commit()
    706706{
    707     AutoLock alock (this);
     707    AutoWriteLock alock (this);
    708708    if (mData.isBackedUp())
    709709    {
     
    712712        {
    713713            // attach new data to the peer and reshare it
    714             AutoLock peerlock (mPeer);
     714            AutoWriteLock peerlock (mPeer);
    715715            mPeer->mData.attach (mData);
    716716        }
     
    720720void BIOSSettings::copyFrom (BIOSSettings *aThat)
    721721{
    722     AutoLock alock (this);
     722    AutoWriteLock alock (this);
    723723
    724724    // this will back up current data
  • trunk/src/VBox/Main/ConsoleImpl.cpp

    r7992 r8083  
    860860    AssertComRCReturnVoid (autoCaller.rc());
    861861
    862     AutoReaderLock alock (that);
     862    AutoReadLock alock (that);
    863863
    864864    int vrc = SSMR3PutU32 (pSSM, (uint32_t)that->mSharedFolders.size());
     
    923923    AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED);
    924924
    925     AutoLock alock (that);
     925    AutoWriteLock alock (that);
    926926
    927927    AssertReturn (that->mSharedFolders.size() == 0, VERR_INTERNAL_ERROR);
     
    995995    CheckComRCReturnRC (autoCaller.rc());
    996996
    997     AutoReaderLock alock (this);
     997    AutoReadLock alock (this);
    998998
    999999    /* we return our local state (since it's always the same as on the server) */
     
    10681068
    10691069    /* we need a write lock because of the lazy mDebugger initialization*/
    1070     AutoLock alock (this);
     1070    AutoWriteLock alock (this);
    10711071
    10721072    /* check if we have to create the debugger object */
     
    10901090    CheckComRCReturnRC (autoCaller.rc());
    10911091
    1092     AutoReaderLock alock (this);
     1092    AutoReadLock alock (this);
    10931093
    10941094    ComObjPtr <OUSBDeviceCollection> collection;
     
    11081108    CheckComRCReturnRC (autoCaller.rc());
    11091109
    1110     AutoReaderLock alock (this);
     1110    AutoReadLock alock (this);
    11111111
    11121112    ComObjPtr <RemoteUSBDeviceCollection> collection;
     
    11421142
    11431143    /* loadDataFromSavedState() needs a write lock */
    1144     AutoLock alock (this);
     1144    AutoWriteLock alock (this);
    11451145
    11461146    /* Read console data stored in the saved state file (if not yet done) */
     
    11671167    CheckComRCReturnRC (autoCaller.rc());
    11681168
    1169     AutoLock alock (this);
     1169    AutoWriteLock alock (this);
    11701170
    11711171    if (mMachineState >= MachineState_Running)
     
    14001400    CheckComRCReturnRC (autoCaller.rc());
    14011401
    1402     AutoLock alock (this);
     1402    AutoWriteLock alock (this);
    14031403
    14041404    if (mMachineState != MachineState_Running &&
     
    14321432    CheckComRCReturnRC (autoCaller.rc());
    14331433
    1434     AutoLock alock (this);
     1434    AutoWriteLock alock (this);
    14351435
    14361436    if (mMachineState != MachineState_Running)
     
    14631463    CheckComRCReturnRC (autoCaller.rc());
    14641464
    1465     AutoLock alock (this);
     1465    AutoWriteLock alock (this);
    14661466
    14671467    if (mMachineState != MachineState_Running)
     
    14971497    CheckComRCReturnRC (autoCaller.rc());
    14981498
    1499     AutoLock alock (this);
     1499    AutoWriteLock alock (this);
    15001500
    15011501    if (mMachineState != MachineState_Paused)
     
    15311531    CheckComRCReturnRC (autoCaller.rc());
    15321532
    1533     AutoLock lock (this);
     1533    AutoWriteLock alock (this);
    15341534
    15351535    if (mMachineState != MachineState_Running)
     
    15721572    AutoCaller autoCaller (this);
    15731573
    1574     AutoLock lock (this);
     1574    AutoWriteLock alock (this);
    15751575
    15761576    if (mMachineState != MachineState_Running)
     
    16111611    CheckComRCReturnRC (autoCaller.rc());
    16121612
    1613     AutoLock lock (this);
     1613    AutoWriteLock alock (this);
    16141614
    16151615    if (mMachineState != MachineState_Running)
     
    16521652    CheckComRCReturnRC (autoCaller.rc());
    16531653
    1654     AutoLock alock (this);
     1654    AutoWriteLock alock (this);
    16551655
    16561656    if (mMachineState != MachineState_Running &&
     
    17921792    CheckComRCReturnRC (autoCaller.rc());
    17931793
    1794     AutoLock alock (this);
     1794    AutoWriteLock alock (this);
    17951795
    17961796    if (mMachineState != MachineState_PoweredOff &&
     
    18091809    CheckComRCReturnRC (autoCaller.rc());
    18101810
    1811     AutoLock alock (this);
     1811    AutoWriteLock alock (this);
    18121812
    18131813    if (mMachineState != MachineState_Saved)
     
    19251925    CheckComRCReturnRC (autoCaller.rc());
    19261926
    1927     AutoLock alock (this);
     1927    AutoWriteLock alock (this);
    19281928
    19291929    /// @todo (r=dmik) is it legal to attach USB devices when the machine is
     
    19861986    CheckComRCReturnRC (autoCaller.rc());
    19871987
    1988     AutoLock alock (this);
     1988    AutoWriteLock alock (this);
    19891989
    19901990    /* Find it. */
     
    20562056    CheckComRCReturnRC (autoCaller.rc());
    20572057
    2058     AutoLock alock (this);
     2058    AutoWriteLock alock (this);
    20592059
    20602060    /// @todo see @todo in AttachUSBDevice() about the Paused state
     
    21282128    CheckComRCReturnRC (autoCaller.rc());
    21292129
    2130     AutoLock alock (this);
     2130    AutoWriteLock alock (this);
    21312131
    21322132    /// @todo see @todo in AttachUSBDevice() about the Paused state
     
    21932193    CheckComRCReturnRC (autoCaller.rc());
    21942194
    2195     AutoLock alock (this);
     2195    AutoWriteLock alock (this);
    21962196
    21972197    if (mMachineState > MachineState_Paused)
     
    23642364    CheckComRCReturnRC (autoCaller.rc());
    23652365
    2366     AutoLock alock (this);
     2366    AutoWriteLock alock (this);
    23672367
    23682368    if (mMachineState >= MachineState_Running)
     
    23852385    CheckComRCReturnRC (autoCaller.rc());
    23862386
    2387     AutoLock alock (this);
     2387    AutoWriteLock alock (this);
    23882388
    23892389    if (mMachineState >= MachineState_Running)
     
    24062406    CheckComRCReturnRC (autoCaller.rc());
    24072407
    2408     AutoLock alock (this);
     2408    AutoWriteLock alock (this);
    24092409
    24102410    if (mMachineState >= MachineState_Running)
     
    24312431    CheckComRCReturnRC (autoCaller.rc());
    24322432
    2433     AutoLock alock (this);
     2433    AutoWriteLock alock (this);
    24342434
    24352435    mCallbacks.push_back (CallbackList::value_type (aCallback));
     
    24732473    CheckComRCReturnRC (autoCaller.rc());
    24742474
    2475     AutoLock alock (this);
     2475    AutoWriteLock alock (this);
    24762476
    24772477    CallbackList::iterator it;
     
    25032503
    25042504    /* doDriveChange() needs a write lock */
    2505     AutoLock alock (this);
     2505    AutoWriteLock alock (this);
    25062506
    25072507    /* Ignore callbacks when there's no VM around */
     
    26002600
    26012601    /* doDriveChange() needs a write lock */
    2602     AutoLock alock (this);
     2602    AutoWriteLock alock (this);
    26032603
    26042604    /* Ignore callbacks when there's no VM around */
     
    27202720
    27212721    /* We will need to release the write lock before calling EMT */
    2722     AutoLock alock (this);
     2722    AutoWriteLock alock (this);
    27232723
    27242724    /* protect mpVM */
     
    28122812     * meDVDState/meFloppyState members (pointed to by peState).
    28132813     */
    2814     AutoLock alock (pThis);
     2814    AutoWriteLock alock (pThis);
    28152815
    28162816    /* protect mpVM */
     
    31013101    AssertComRCReturnRC (autoCaller.rc());
    31023102
    3103     AutoLock alock (this);
     3103    AutoWriteLock alock (this);
    31043104
    31053105    /* Don't do anything if the VM isn't running */
     
    31873187    AssertComRCReturnRC (autoCaller.rc());
    31883188
    3189     AutoLock alock (this);
     3189    AutoWriteLock alock (this);
    31903190
    31913191    /* Don't do anything if the VM isn't running */
     
    32253225    AssertComRCReturnRC (autoCaller.rc());
    32263226
    3227     AutoLock alock (this);
     3227    AutoWriteLock alock (this);
    32283228
    32293229    /* Don't do anything if the VM isn't running */
     
    32613261    AssertComRCReturnRC (autoCaller.rc());
    32623262
    3263     AutoLock alock (this);
     3263    AutoWriteLock alock (this);
    32643264
    32653265    HRESULT rc = S_OK;
     
    33173317    AssertComRCReturnRC (autoCaller.rc());
    33183318
    3319     AutoLock alock (this);
     3319    AutoWriteLock alock (this);
    33203320
    33213321    /* Ignore if no VM is running yet. */
     
    33593359    AssertComRCReturnRC (autoCaller.rc());
    33603360
    3361     AutoLock alock (this);
     3361    AutoWriteLock alock (this);
    33623362
    33633363    HRESULT rc = fetchSharedFolders (aGlobal);
     
    33983398    ComAssertComRCRetRC (autoCaller.rc());
    33993399
    3400     AutoLock alock (this);
     3400    AutoWriteLock alock (this);
    34013401
    34023402    /* protect mpVM (we don't need error info, since it's a callback) */
     
    34643464    AssertComRCReturnRC (autoCaller.rc());
    34653465
    3466     AutoLock alock (this);
     3466    AutoWriteLock alock (this);
    34673467
    34683468    /* Find the device. */
     
    35453545    AssertComRCReturnRC (autoCaller.rc());
    35463546
    3547     AutoLock alock (this);
     3547    AutoWriteLock alock (this);
    35483548
    35493549    AssertReturn (mMachineState == MachineState_Saving ||
     
    35733573
    35743574    /* We need a write lock because we alter the cached callback data */
    3575     AutoLock alock (this);
     3575    AutoWriteLock alock (this);
    35763576
    35773577    /* Save the callback arguments */
     
    36403640
    36413641    /* We need a write lock because we alter the cached callback data */
    3642     AutoLock alock (this);
     3642    AutoWriteLock alock (this);
    36433643
    36443644    /* save the callback arguments */
     
    36633663    AssertComRCReturnVoid (autoCaller.rc());
    36643664
    3665     AutoReaderLock alock (this);
     3665    AutoReadLock alock (this);
    36663666
    36673667    CallbackList::iterator it = mCallbacks.begin();
     
    36783678    AssertComRCReturnVoid (autoCaller.rc());
    36793679
    3680     AutoReaderLock alock (this);
     3680    AutoReadLock alock (this);
    36813681
    36823682    CallbackList::iterator it = mCallbacks.begin();
     
    36933693    AssertComRCReturnVoid (autoCaller.rc());
    36943694
    3695     AutoReaderLock alock (this);
     3695    AutoReadLock alock (this);
    36963696
    36973697    /** @todo Use the On-Screen Display feature to report the fact.
     
    37113711
    37123712    /* We need a write lock because we alter the cached callback data */
    3713     AutoLock alock (this);
     3713    AutoWriteLock alock (this);
    37143714
    37153715    /* save the callback arguments */
     
    37333733    AssertComRCReturnVoid (autoCaller.rc());
    37343734
    3735     AutoReaderLock alock (this);
     3735    AutoReadLock alock (this);
    37363736
    37373737    CallbackList::iterator it = mCallbacks.begin();
     
    37483748    AssertComRCReturnVoid (autoCaller.rc());
    37493749
    3750     AutoReaderLock alock (this);
     3750    AutoReadLock alock (this);
    37513751
    37523752    CallbackList::iterator it = mCallbacks.begin();
     
    37693769    AssertComRCReturnRC (autoCaller.rc());
    37703770
    3771     AutoReaderLock alock (this);
     3771    AutoReadLock alock (this);
    37723772
    37733773    HRESULT rc = S_OK;
     
    38373837    AssertComRCReturnRC (autoCaller.rc());
    38383838
    3839     AutoLock alock (this);
     3839    AutoWriteLock alock (this);
    38403840
    38413841    if (mVMDestroying)
     
    38713871    AssertComRCReturnVoid (autoCaller.rc());
    38723872
    3873     AutoLock alock (this);
     3873    AutoWriteLock alock (this);
    38743874
    38753875    AssertReturnVoid (mpVM != NULL);
     
    40144014    AssertComRCReturnRC (autoCaller.rc());
    40154015
    4016     AutoLock alock (this);
     4016    AutoWriteLock alock (this);
    40174017
    40184018    /* sanity */
     
    42354235    AssertComRCReturnRC (autoCaller.rc());
    42364236
    4237     AutoLock alock (this);
     4237    AutoWriteLock alock (this);
    42384238
    42394239    HRESULT rc = S_OK;
     
    42974297{
    42984298    /* sanity check */
    4299     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     4299    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    43004300
    43014301    SharedFolderMap::const_iterator it = mSharedFolders.find (aName);
     
    43244324    /* sanity check */
    43254325    AssertReturn (AutoCaller (this).state() == InInit ||
    4326                   isLockedOnCurrentThread(), E_FAIL);
     4326                  isWriteLockOnCurrentThread(), E_FAIL);
    43274327
    43284328    /* protect mpVM (if not NULL) */
     
    44474447{
    44484448    /* sanity check */
    4449     AssertReturn (isLockedOnCurrentThread(), false);
     4449    AssertReturn (isWriteLockOnCurrentThread(), false);
    44504450
    44514451    /* first, search machine folders */
     
    46264626        case VMSTATE_OFF:
    46274627        {
    4628             AutoLock alock (that);
     4628            AutoWriteLock alock (that);
    46294629
    46304630            if (that->mVMStateChangeCallbackDisabled)
     
    46904690        case VMSTATE_TERMINATED:
    46914691        {
    4692             AutoLock alock (that);
     4692            AutoWriteLock alock (that);
    46934693
    46944694            if (that->mVMStateChangeCallbackDisabled)
     
    47494749            if (aOldState == VMSTATE_RUNNING)
    47504750            {
    4751                 AutoLock alock (that);
     4751                AutoWriteLock alock (that);
    47524752
    47534753                if (that->mVMStateChangeCallbackDisabled)
     
    47674767                aOldState == VMSTATE_SUSPENDED)
    47684768            {
    4769                 AutoLock alock (that);
     4769                AutoWriteLock alock (that);
    47704770
    47714771                if (that->mVMStateChangeCallbackDisabled)
     
    47904790        case VMSTATE_GURU_MEDITATION:
    47914791        {
    4792             AutoLock alock (that);
     4792            AutoWriteLock alock (that);
    47934793
    47944794            if (that->mVMStateChangeCallbackDisabled)
     
    48234823{
    48244824    AssertReturn (aHostDevice, E_FAIL);
    4825     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     4825    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    48264826
    48274827    /* still want a lock object because we need to leave it */
    4828     AutoLock alock (this);
     4828    AutoWriteLock alock (this);
    48294829
    48304830    HRESULT hrc;
     
    49404940        AssertComRC (hrc);
    49414941
    4942         AutoLock alock (that);
     4942        AutoWriteLock alock (that);
    49434943        that->mUSBDevices.push_back (device);
    49444944        LogFlowFunc (("Attached device {%Vuuid}\n", device->id().raw()));
     
    49654965HRESULT Console::detachUSBDevice (USBDeviceList::iterator &aIt)
    49664966{
    4967     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     4967    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    49684968
    49694969    /* still want a lock object because we need to leave it */
    4970     AutoLock alock (this);
     4970    AutoWriteLock alock (this);
    49714971
    49724972    /* protect mpVM */
     
    50345034    if (VBOX_SUCCESS (vrc))
    50355035    {
    5036         AutoLock alock (that);
     5036        AutoWriteLock alock (that);
    50375037
    50385038        /* Remove the device from the collection */
     
    51525152    LogFlowThisFunc(("\n"));
    51535153    /* sanity check */
    5154     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     5154    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    51555155
    51565156#ifdef DEBUG
     
    53505350    /* sanity check */
    53515351    LogFlowThisFunc(("\n"));
    5352     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     5352    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    53535353
    53545354    HRESULT rc = S_OK;
     
    54485448
    54495449    /* sanity check */
    5450     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     5450    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    54515451
    54525452    /*
     
    55845584
    55855585    /* sanity check */
    5586     ComAssertRet (isLockedOnCurrentThread(), E_FAIL);
     5586    ComAssertRet (isWriteLockOnCurrentThread(), E_FAIL);
    55875587
    55885588    /* If the machine has an USB controller, ask the USB proxy service to
     
    55955595         * us back from under its lock (e.g. onUSBDeviceAttach()) which would
    55965596         * produce an inter-process dead-lock otherwise. */
    5597         AutoLock alock (this);
     5597        AutoWriteLock alock (this);
    55985598        alock.leave();
    55995599
     
    56225622
    56235623    /* sanity check */
    5624     AssertReturnVoid (isLockedOnCurrentThread());
     5624    AssertReturnVoid (isWriteLockOnCurrentThread());
    56255625
    56265626    mUSBDevices.clear();
     
    56295629     * us back from under its lock (e.g. onUSBDeviceAttach()) which would
    56305630     * produce an inter-process dead-lock otherwise. */
    5631     AutoLock alock (this);
     5631    AutoWriteLock alock (this);
    56325632    alock.leave();
    56335633
     
    56545654    }
    56555655
    5656     AutoLock alock (this);
     5656    AutoWriteLock alock (this);
    56575657
    56585658    /*
     
    58455845    /* Note: no need to use addCaller() because VMPowerUpTask does that */
    58465846
    5847     AutoLock alock (console);
     5847    AutoWriteLock alock (console);
    58485848
    58495849    /* sanity */
     
    63856385
    63866386    /* lock the console sonce we're going to access it */
    6387     AutoLock thatLock (that);
     6387    AutoWriteLock thatLock (that);
    63886388
    63896389    if (SUCCEEDED (rc))
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r7990 r8083  
    8888
    8989    /* lock the console because we widely use internal fields and methods */
    90     AutoLock alock (pConsole);
     90    AutoWriteLock alock (pConsole);
    9191
    9292    ComPtr <IMachine> pMachine = pConsole->machine();
  • trunk/src/VBox/Main/ConsoleVRDPServer.cpp

    r7761 r8083  
    633633            com::Bstr bstr;
    634634            server->mConsole->getVRDPServer ()->COMGETTER(NetAddress) (bstr.asOutParam());
    635            
     635
    636636            /* The server expects UTF8. */
    637637            com::Utf8Str address = bstr;
    638638
    639639            size_t cbAddress = address.length () + 1;
    640            
     640
    641641            if (cbAddress >= 0x10000)
    642642            {
     
    645645                break;
    646646            }
    647            
     647
    648648            if ((size_t)cbBuffer >= cbAddress)
    649649            {
     
    974974                server->m_InputSynch.fClientScrollLock = (pInputSynch->uLockStatus & VRDP_INPUT_SYNCH_SCROLL) != 0;
    975975
    976                 /* The client initiated synchronization. Always make the guest to reflect the client state. 
     976                /* The client initiated synchronization. Always make the guest to reflect the client state.
    977977                 * Than means, when the guest changes the state itself, it is forced to return to the client
    978978                 * state.
     
    10371037    m_InputSynch.fGuestCapsLock   = false;
    10381038    m_InputSynch.fGuestScrollLock = false;
    1039    
     1039
    10401040    m_InputSynch.fClientNumLock    = false;
    10411041    m_InputSynch.fClientCapsLock   = false;
    10421042    m_InputSynch.fClientScrollLock = false;
    1043    
     1043
    10441044    memset (maFramebuffers, 0, sizeof (maFramebuffers));
    10451045
     
    20182018    ComAssertRet (aParent, E_INVALIDARG);
    20192019
    2020     AutoLock alock (this);
     2020    AutoWriteLock alock (this);
    20212021    ComAssertRet (!isReady(), E_UNEXPECTED);
    20222022
     
    20352035    LogFlowMember (("RemoteDisplayInfo::uninit()\n"));
    20362036
    2037     AutoLock alock (this);
     2037    AutoWriteLock alock (this);
    20382038    AssertReturn (isReady(), (void) 0);
    20392039
     
    20522052            return E_POINTER;                                             \
    20532053                                                                          \
    2054         AutoLock alock (this);                                            \
     2054        AutoWriteLock alock (this);                                            \
    20552055        CHECK_READY();                                                    \
    20562056                                                                          \
     
    20722072            return E_POINTER;                                             \
    20732073                                                                          \
    2074         AutoLock alock (this);                                            \
     2074        AutoWriteLock alock (this);                                            \
    20752075        CHECK_READY();                                                    \
    20762076                                                                          \
     
    20922092            return E_POINTER;                                             \
    20932093                                                                          \
    2094         AutoLock alock (this);                                            \
     2094        AutoWriteLock alock (this);                                            \
    20952095        CHECK_READY();                                                    \
    20962096                                                                          \
  • trunk/src/VBox/Main/DVDDriveImpl.cpp

    r7992 r8083  
    9797    AssertComRCReturnRC (thatCaller.rc());
    9898
    99     AutoReaderLock thatLock (aThat);
     99    AutoReadLock thatLock (aThat);
    100100    mData.share (aThat->mData);
    101101
     
    129129    AssertComRCReturnRC (thatCaller.rc());
    130130
    131     AutoReaderLock thatLock (aThat);
     131    AutoReadLock thatLock (aThat);
    132132    mData.attachCopy (aThat->mData);
    133133
     
    168168    CheckComRCReturnRC (autoCaller.rc());
    169169
    170     AutoReaderLock alock (this);
     170    AutoReadLock alock (this);
    171171
    172172    *aDriveState = mData->mDriveState;
     
    183183    CheckComRCReturnRC (autoCaller.rc());
    184184
    185     AutoReaderLock alock (this);
     185    AutoReadLock alock (this);
    186186
    187187    *aPassthrough = mData->mPassthrough;
     
    199199    CheckComRCReturnRC (adep.rc());
    200200
    201     AutoLock alock (this);
     201    AutoWriteLock alock (this);
    202202
    203203    if (mData->mPassthrough != aPassthrough)
     
    225225    CheckComRCReturnRC (adep.rc());
    226226
    227     AutoLock alock (this);
     227    AutoWriteLock alock (this);
    228228
    229229    HRESULT rc = E_FAIL;
     
    269269    CheckComRCReturnRC (adep.rc());
    270270
    271     AutoLock alock (this);
     271    AutoWriteLock alock (this);
    272272
    273273    if (mData->mDriveState != DriveState_HostDriveCaptured ||
     
    299299    CheckComRCReturnRC (adep.rc());
    300300
    301     AutoLock alock (this);
     301    AutoWriteLock alock (this);
    302302
    303303    if (mData->mDriveState != DriveState_NotMounted)
     
    326326    CheckComRCReturnRC (autoCaller.rc());
    327327
    328     AutoReaderLock alock (this);
     328    AutoReadLock alock (this);
    329329
    330330    mData->mDVDImage.queryInterfaceTo (aDVDImage);
     
    341341    CheckComRCReturnRC (autoCaller.rc());
    342342
    343     AutoReaderLock alock (this);
     343    AutoReadLock alock (this);
    344344
    345345    mData->mHostDrive.queryInterfaceTo (aHostDrive);
     
    368368    AssertComRCReturnRC (autoCaller.rc());
    369369
    370     AutoLock alock (this);
     370    AutoWriteLock alock (this);
    371371
    372372    /* Note: we assume that the default values for attributes of optional
     
    451451    AssertComRCReturnRC (autoCaller.rc());
    452452
    453     AutoReaderLock alock (this);
     453    AutoReadLock alock (this);
    454454
    455455    Key node = aMachineNode.createKey ("DVDDrive");
     
    506506    AssertComRCReturn (autoCaller.rc(), false);
    507507
    508     AutoLock alock (this);
     508    AutoWriteLock alock (this);
    509509
    510510    bool changed = false;
     
    585585HRESULT DVDDrive::unmount()
    586586{
    587     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     587    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    588588
    589589    if (mData->mDVDImage)
  • trunk/src/VBox/Main/DVDImageImpl.cpp

    r5999 r8083  
    168168    CheckComRCReturnRC (autoCaller.rc());
    169169
    170     AutoReaderLock alock (this);
     170    AutoReadLock alock (this);
    171171
    172172    mImageFileFull.cloneTo (aFilePath);
     
    183183    CheckComRCReturnRC (autoCaller.rc());
    184184
    185     AutoLock alock (this);
     185    AutoWriteLock alock (this);
    186186
    187187    HRESULT rc = S_OK;
     
    218218    CheckComRCReturnRC (autoCaller.rc());
    219219
    220     AutoReaderLock alock (this);
     220    AutoReadLock alock (this);
    221221
    222222    RTFILE file;
     
    270270    AssertComRCReturnVoid (autoCaller.rc());
    271271
    272     AutoLock alock (this);
     272    AutoWriteLock alock (this);
    273273
    274274    unconst (mImageFileFull) = aNewFullPath;
  • trunk/src/VBox/Main/DisplayImpl.cpp

    r7258 r8083  
    112112    ComAssertRet (parent, E_INVALIDARG);
    113113
    114     AutoLock alock (this);
     114    AutoWriteLock alock (this);
    115115    ComAssertRet (!isReady(), E_UNEXPECTED);
    116116
     
    167167    LogFlowFunc (("isReady=%d\n", isReady()));
    168168
    169     AutoLock alock (this);
     169    AutoWriteLock alock (this);
    170170    AssertReturn (isReady(), (void) 0);
    171171
     
    12461246        return E_POINTER;
    12471247
    1248     AutoLock alock (this);
     1248    AutoWriteLock alock (this);
    12491249    CHECK_READY();
    12501250
     
    12661266        return E_POINTER;
    12671267
    1268     AutoLock alock (this);
     1268    AutoWriteLock alock (this);
    12691269    CHECK_READY();
    12701270
     
    12861286        return E_INVALIDARG;
    12871287
    1288     AutoLock alock (this);
     1288    AutoWriteLock alock (this);
    12891289    CHECK_READY();
    12901290
     
    13061306    LogFlowFunc (("\n"));
    13071307
    1308     AutoLock lock (this);
     1308    AutoWriteLock alock (this);
    13091309    CHECK_READY();
    13101310
     
    13261326    {
    13271327        /* Must leave the lock here because the changeFramebuffer will also obtain it. */
    1328         lock.leave ();
     1328        alock.leave ();
    13291329
    13301330        /* send request to the EMT thread */
     
    13381338        VMR3ReqFree (pReq);
    13391339
    1340         lock.enter ();
     1340        alock.enter ();
    13411341
    13421342        ComAssertRCRet (vrc, E_FAIL);
     
    13571357        return E_POINTER;
    13581358
    1359     AutoLock lock(this);
     1359    AutoWriteLock alock (this);
    13601360    CHECK_READY();
    13611361
     
    13771377STDMETHODIMP Display::UnlockFramebuffer()
    13781378{
    1379     AutoLock lock(this);
     1379    AutoWriteLock alock (this);
    13801380    CHECK_READY();
    13811381
     
    14001400        return E_POINTER;
    14011401
    1402     AutoLock lock (this);
     1402    AutoWriteLock alock (this);
    14031403    CHECK_READY();
    14041404
     
    14071407    {
    14081408        /* Must leave the lock here because the changeFramebuffer will also obtain it. */
    1409         lock.leave ();
     1409        alock.leave ();
    14101410
    14111411        /* send request to the EMT thread */
     
    14181418        VMR3ReqFree (pReq);
    14191419
    1420         lock.enter ();
     1420        alock.enter ();
    14211421
    14221422        ComAssertRCRet (vrc, E_FAIL);
     
    14391439        return E_POINTER;
    14401440
    1441     AutoLock lock (this);
     1441    AutoWriteLock alock (this);
    14421442    CHECK_READY();
    14431443
     
    14461446    {
    14471447        /* Must leave the lock here because the changeFramebuffer will also obtain it. */
    1448         lock.leave ();
     1448        alock.leave ();
    14491449
    14501450        /* send request to the EMT thread */
     
    14571457        VMR3ReqFree (pReq);
    14581458
    1459         lock.enter ();
     1459        alock.enter ();
    14601460
    14611461        ComAssertRCRet (vrc, E_FAIL);
     
    14781478        return E_POINTER;
    14791479
    1480     AutoLock lock (this);
     1480    AutoWriteLock alock (this);
    14811481    CHECK_READY();
    14821482
     
    14971497STDMETHODIMP Display::SetVideoModeHint(ULONG aWidth, ULONG aHeight, ULONG aBitsPerPixel, ULONG aDisplay)
    14981498{
    1499     AutoLock lock(this);
     1499    AutoWriteLock alock (this);
    15001500    CHECK_READY();
    15011501
     
    15341534
    15351535    /* Have to leave the lock because the pfnRequestDisplayChange will call EMT.  */
    1536     lock.leave ();
     1536    alock.leave ();
    15371537    if (mParent->getVMMDev())
    15381538        mParent->getVMMDev()->getVMMDevPort()->
     
    15441544STDMETHODIMP Display::SetSeamlessMode (BOOL enabled)
    15451545{
    1546     AutoLock lock(this);
     1546    AutoWriteLock alock (this);
    15471547    CHECK_READY();
    15481548
    15491549    /* Have to leave the lock because the pfnRequestSeamlessChange will call EMT.  */
    1550     lock.leave ();
     1550    alock.leave ();
    15511551    if (mParent->getVMMDev())
    15521552        mParent->getVMMDev()->getVMMDevPort()->
     
    15731573        return E_INVALIDARG;
    15741574
    1575     AutoLock lock(this);
     1575    AutoWriteLock alock (this);
    15761576    CHECK_READY();
    15771577
     
    16431643        return E_INVALIDARG;
    16441644
    1645     AutoLock lock(this);
     1645    AutoWriteLock alock (this);
    16461646    CHECK_READY();
    16471647
     
    17001700    LogFlowFuncEnter();
    17011701
    1702     AutoLock lock(this);
     1702    AutoWriteLock alock (this);
    17031703    CHECK_READY();
    17041704
     
    17381738    LogFlowFunc (("\n"));
    17391739
    1740     /// @todo (dmik) can we AutoLock alock (this); here?
     1740    /// @todo (dmik) can we AutoWriteLock alock (this); here?
    17411741    //  do it when we switch this class to VirtualBoxBase_NEXT.
    17421742    //  This will require general code review and may add some details.
     
    17711771    LogFlowFunc (("\n"));
    17721772
    1773     /// @todo (dmik) can we AutoLock alock (this); here?
     1773    /// @todo (dmik) can we AutoWriteLock alock (this); here?
    17741774    //  do it when we switch this class to VirtualBoxBase_NEXT.
    17751775    //  Tthis will require general code review and may add some details.
     
    19051905    /// @todo (r=dmik) AutoCaller
    19061906
    1907     AutoLock alock (that);
     1907    AutoWriteLock alock (that);
    19081908
    19091909    DISPLAYFBINFO *pDisplayFBInfo = &that->maFramebuffers[uScreenId];
     
    23882388    if (pData->pDisplay)
    23892389    {
    2390         AutoLock displayLock (pData->pDisplay);
     2390        AutoWriteLock displayLock (pData->pDisplay);
    23912391        pData->pDisplay->mpDrv = NULL;
    23922392        pData->pDisplay->mpVMMDev = NULL;
  • trunk/src/VBox/Main/FloppyDriveImpl.cpp

    r7992 r8083  
    9797    AssertComRCReturnRC (thatCaller.rc());
    9898
    99     AutoReaderLock thatLock (aThat);
     99    AutoReadLock thatLock (aThat);
    100100    mData.share (aThat->mData);
    101101
     
    129129    AssertComRCReturnRC (thatCaller.rc());
    130130
    131     AutoReaderLock thatLock (aThat);
     131    AutoReadLock thatLock (aThat);
    132132    mData.attachCopy (aThat->mData);
    133133
     
    168168    CheckComRCReturnRC (autoCaller.rc());
    169169
    170     AutoReaderLock alock (this);
     170    AutoReadLock alock (this);
    171171
    172172    *aEnabled = mData->mEnabled;
     
    186186    CheckComRCReturnRC (adep.rc());
    187187
    188     AutoLock alock (this);
     188    AutoWriteLock alock (this);
    189189
    190190    if (mData->mEnabled != aEnabled)
     
    210210    CheckComRCReturnRC (autoCaller.rc());
    211211
    212     AutoReaderLock alock (this);
     212    AutoReadLock alock (this);
    213213
    214214    *aDriveState = mData->mDriveState;
     
    232232    CheckComRCReturnRC (adep.rc());
    233233
    234     AutoLock alock (this);
     234    AutoWriteLock alock (this);
    235235
    236236    HRESULT rc = E_FAIL;
     
    276276    CheckComRCReturnRC (adep.rc());
    277277
    278     AutoLock alock (this);
     278    AutoWriteLock alock (this);
    279279
    280280    if (mData->mDriveState != DriveState_HostDriveCaptured ||
     
    306306    CheckComRCReturnRC (adep.rc());
    307307
    308     AutoLock alock (this);
     308    AutoWriteLock alock (this);
    309309
    310310    if (mData->mDriveState != DriveState_NotMounted)
     
    333333    CheckComRCReturnRC (autoCaller.rc());
    334334
    335     AutoReaderLock alock (this);
     335    AutoReadLock alock (this);
    336336
    337337    mData->mFloppyImage.queryInterfaceTo (aFloppyImage);
     
    348348    CheckComRCReturnRC (autoCaller.rc());
    349349
    350     AutoReaderLock alock (this);
     350    AutoReadLock alock (this);
    351351
    352352    mData->mHostDrive.queryInterfaceTo (aHostDrive);
     
    375375    AssertComRCReturnRC (autoCaller.rc());
    376376
    377     AutoLock alock (this);
     377    AutoWriteLock alock (this);
    378378
    379379    /* Note: we assume that the default values for attributes of optional
     
    458458    AssertComRCReturnRC (autoCaller.rc());
    459459
    460     AutoReaderLock alock (this);
     460    AutoReadLock alock (this);
    461461
    462462    Key node = aMachineNode.createKey ("FloppyDrive");
     
    513513    AssertComRCReturn (autoCaller.rc(), false);
    514514
    515     AutoLock alock (this);
     515    AutoWriteLock alock (this);
    516516
    517517    bool changed = false;
     
    589589HRESULT FloppyDrive::unmount()
    590590{
    591     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     591    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    592592
    593593    if (mData->mFloppyImage)
  • trunk/src/VBox/Main/FloppyImageImpl.cpp

    r5999 r8083  
    164164    CheckComRCReturnRC (autoCaller.rc());
    165165
    166     AutoReaderLock alock (this);
     166    AutoReadLock alock (this);
    167167
    168168    mImageFileFull.cloneTo (aFilePath);
     
    179179    CheckComRCReturnRC (autoCaller.rc());
    180180
    181     AutoLock alock (this);
     181    AutoWriteLock alock (this);
    182182
    183183    HRESULT rc = S_OK;
     
    214214    CheckComRCReturnRC (autoCaller.rc());
    215215
    216     AutoReaderLock alock (this);
     216    AutoReadLock alock (this);
    217217
    218218    RTFILE file;
     
    265265    AssertComRCReturnVoid (autoCaller.rc());
    266266
    267     AutoLock alock (this);
     267    AutoWriteLock alock (this);
    268268
    269269    unconst (mImageFileFull) = aNewFullPath;
  • trunk/src/VBox/Main/GuestImpl.cpp

    r7409 r8083  
    116116    CheckComRCReturnRC (autoCaller.rc());
    117117
    118     AutoReaderLock alock (this);
     118    AutoReadLock alock (this);
    119119
    120120    // redirect the call to IMachine if no additions are installed
     
    135135    CheckComRCReturnRC (autoCaller.rc());
    136136
    137     AutoReaderLock alock (this);
     137    AutoReadLock alock (this);
    138138
    139139    *aAdditionsActive = mData.mAdditionsActive;
     
    150150    CheckComRCReturnRC (autoCaller.rc());
    151151
    152     AutoReaderLock alock (this);
     152    AutoReadLock alock (this);
    153153
    154154    mData.mAdditionsVersion.cloneTo (aAdditionsVersion);
     
    165165    CheckComRCReturnRC (autoCaller.rc());
    166166
    167     AutoReaderLock alock (this);
     167    AutoReadLock alock (this);
    168168
    169169    *aSupportsSeamless = mData.mSupportsSeamless;
     
    180180    CheckComRCReturnRC (autoCaller.rc());
    181181
    182     AutoReaderLock alock (this);
     182    AutoReadLock alock (this);
    183183
    184184    *aSupportsGraphics = mData.mSupportsGraphics;
     
    195195    CheckComRCReturnRC (autoCaller.rc());
    196196
    197     AutoReaderLock alock (this);
     197    AutoReadLock alock (this);
    198198
    199199    *aMemoryBalloonSize = mMemoryBalloonSize;
     
    207207    CheckComRCReturnRC (autoCaller.rc());
    208208
    209     AutoLock alock (this);
     209    AutoWriteLock alock (this);
    210210
    211211    HRESULT ret = mParent->machine()->COMSETTER(MemoryBalloonSize)(aMemoryBalloonSize);
     
    230230    CheckComRCReturnRC (autoCaller.rc());
    231231
    232     AutoReaderLock alock (this);
     232    AutoReadLock alock (this);
    233233
    234234    *aUpdateInterval = mStatUpdateInterval;
     
    242242    CheckComRCReturnRC (autoCaller.rc());
    243243
    244     AutoLock alock (this);
     244    AutoWriteLock alock (this);
    245245
    246246    HRESULT ret = mParent->machine()->COMSETTER(StatisticsUpdateInterval)(aUpdateInterval);
     
    326326    AssertComRCReturnVoid (autoCaller.rc());
    327327
    328     AutoLock alock (this);
     328    AutoWriteLock alock (this);
    329329
    330330    mData.mAdditionsVersion = aVersion;
     
    338338    AssertComRCReturnVoid (autoCaller.rc());
    339339
    340     AutoLock alock (this);
     340    AutoWriteLock alock (this);
    341341
    342342    mData.mSupportsSeamless = aSupportsSeamless;
     
    348348    AssertComRCReturnVoid (autoCaller.rc());
    349349
    350     AutoLock alock (this);
     350    AutoWriteLock alock (this);
    351351
    352352    mData.mSupportsGraphics = aSupportsGraphics;
  • trunk/src/VBox/Main/HardDiskAttachmentImpl.cpp

    r7442 r8083  
    7272    }
    7373
    74     AutoLock alock (this);
     74    AutoWriteLock alock (this);
    7575
    7676    mDirty = aDirty;
     
    9393        return E_POINTER;
    9494
    95     AutoLock alock (this);
     95    AutoWriteLock alock (this);
    9696    CHECK_READY();
    9797
     
    107107        return E_POINTER;
    108108
    109     AutoLock alock (this);
     109    AutoWriteLock alock (this);
    110110    CHECK_READY();
    111111
     
    119119        return E_INVALIDARG;
    120120
    121     AutoLock alock (this);
     121    AutoWriteLock alock (this);
    122122    CHECK_READY();
    123123
     
    131131        return E_INVALIDARG;
    132132
    133     AutoLock alock (this);
     133    AutoWriteLock alock (this);
    134134    CHECK_READY();
    135135
  • trunk/src/VBox/Main/HardDiskImpl.cpp

    r7992 r8083  
    163163 *  is forbidden.
    164164 */
    165 void HardDisk::protectedUninit (AutoLock &alock)
     165void HardDisk::protectedUninit (AutoWriteLock &alock)
    166166{
    167167    LogFlowThisFunc (("\n"));
     
    196196        return E_POINTER;
    197197
    198     AutoReaderLock alock (this);
     198    AutoReadLock alock (this);
    199199    CHECK_READY();
    200200
     
    208208        return E_POINTER;
    209209
    210     AutoReaderLock alock (this);
     210    AutoReadLock alock (this);
    211211    CHECK_READY();
    212212
     
    220220        return E_POINTER;
    221221
    222     AutoReaderLock alock (this);
     222    AutoReadLock alock (this);
    223223    CHECK_READY();
    224224
     
    232232        return E_POINTER;
    233233
    234     AutoReaderLock alock (this);
     234    AutoReadLock alock (this);
    235235    CHECK_READY();
    236236
     
    241241STDMETHODIMP HardDisk::COMSETTER(Type) (HardDiskType_T aType)
    242242{
    243     AutoLock alock (this);
     243    AutoWriteLock alock (this);
    244244    CHECK_READY();
    245245
     
    274274        return E_POINTER;
    275275
    276     AutoReaderLock alock (this);
     276    AutoReadLock alock (this);
    277277    CHECK_READY();
    278278
     
    286286        return E_POINTER;
    287287
    288     AutoReaderLock lock(this);
    289     CHECK_READY();
    290 
    291     AutoReaderLock chLock (childrenLock());
     288    AutoReadLock lock(this);
     289    CHECK_READY();
     290
     291    AutoReadLock chLock (childrenLock());
    292292
    293293    ComObjPtr <HardDiskCollection> collection;
     
    303303        return E_POINTER;
    304304
    305     AutoReaderLock lock(this);
     305    AutoReadLock lock(this);
    306306    CHECK_READY();
    307307
     
    315315        return E_POINTER;
    316316
    317     AutoLock alock (this);
     317    AutoWriteLock alock (this);
    318318    CHECK_READY();
    319319
     
    331331        return E_POINTER;
    332332
    333     AutoLock alock (this);
     333    AutoWriteLock alock (this);
    334334    CHECK_READY();
    335335
     
    342342        while (parent)
    343343        {
    344             AutoLock parentLock (parent);
     344            AutoWriteLock parentLock (parent);
    345345            HRESULT rc = parent->getAccessible (mLastAccessError);
    346346            if (FAILED (rc))
     
    368368        return E_POINTER;
    369369
    370     AutoReaderLock alock (this);
     370    AutoReadLock alock (this);
    371371    CHECK_READY();
    372372
     
    380380        return E_POINTER;
    381381
    382     AutoReaderLock alock (this);
     382    AutoReadLock alock (this);
    383383    CHECK_READY();
    384384
     
    392392        return E_POINTER;
    393393
    394     AutoReaderLock alock (this);
     394    AutoReadLock alock (this);
    395395    CHECK_READY();
    396396
     
    408408        return E_POINTER;
    409409
    410     AutoLock alock (this);
     410    AutoWriteLock alock (this);
    411411    CHECK_READY();
    412412    CHECK_BUSY();
     
    439439        if (!RTPathHavePath (fp))
    440440        {
    441             AutoReaderLock propsLock (mVirtualBox->systemProperties());
     441            AutoReadLock propsLock (mVirtualBox->systemProperties());
    442442            path = Utf8StrFmt ("%ls%c%s",
    443443                mVirtualBox->systemProperties()->defaultVDIFolder().raw(),
     
    529529HRESULT HardDisk::trySetRegistered (BOOL aRegistered)
    530530{
    531     AutoLock alock (this);
     531    AutoWriteLock alock (this);
    532532    CHECK_READY();
    533533
     
    600600                                     bool aCheckReaders /* = false */)
    601601{
    602     AutoReaderLock alock (this);
     602    AutoReadLock alock (this);
    603603    CHECK_READY();
    604604
     
    636636bool HardDisk::sameAs (HardDisk *that)
    637637{
    638     AutoReaderLock alock (this);
     638    AutoReadLock alock (this);
    639639    if (!isReady())
    640640        return false;
     
    655655void HardDisk::setBusy()
    656656{
    657     AutoLock alock (this);
     657    AutoWriteLock alock (this);
    658658    AssertReturnVoid (isReady());
    659659
     
    669669void HardDisk::clearBusy()
    670670{
    671     AutoLock alock (this);
     671    AutoWriteLock alock (this);
    672672    AssertReturnVoid (isReady());
    673673
     
    684684void HardDisk::addReader()
    685685{
    686     AutoLock alock (this);
     686    AutoWriteLock alock (this);
    687687    AssertReturnVoid (isReady());
    688688
     
    697697void HardDisk::releaseReader()
    698698{
    699     AutoLock alock (this);
     699    AutoWriteLock alock (this);
    700700    AssertReturnVoid (isReady());
    701701
     
    711711void HardDisk::addReaderOnAncestors()
    712712{
    713     AutoLock alock (this);
     713    AutoWriteLock alock (this);
    714714    AssertReturnVoid (isReady());
    715715
    716716    if (mParent)
    717717    {
    718         AutoLock alock (mParent);
     718        AutoWriteLock alock (mParent);
    719719        mParent->addReader();
    720720        mParent->addReaderOnAncestors();
     
    727727void HardDisk::releaseReaderOnAncestors()
    728728{
    729     AutoLock alock (this);
     729    AutoWriteLock alock (this);
    730730    AssertReturnVoid (isReady());
    731731
    732732    if (mParent)
    733733    {
    734         AutoLock alock (mParent);
     734        AutoWriteLock alock (mParent);
    735735        mParent->releaseReaderOnAncestors();
    736736        mParent->releaseReader();
     
    744744bool HardDisk::hasForeignChildren()
    745745{
    746     AutoReaderLock alock (this);
     746    AutoReadLock alock (this);
    747747    AssertReturn (isReady(), false);
    748748
     
    750750
    751751    /* check all children */
    752     AutoReaderLock chLock (childrenLock());
     752    AutoReadLock chLock (childrenLock());
    753753    for (HardDiskList::const_iterator it = children().begin();
    754754         it != children().end();
     
    756756    {
    757757        ComObjPtr <HardDisk> child = *it;
    758         AutoReaderLock childLock (child);
     758        AutoReadLock childLock (child);
    759759        if (child->mMachineId != mMachineId)
    760760            return true;
     
    771771HRESULT HardDisk::setBusyWithChildren()
    772772{
    773     AutoLock alock (this);
     773    AutoWriteLock alock (this);
    774774    AssertReturn (isReady(), E_FAIL);
    775775
     
    779779        return setError (E_FAIL, errMsg, toString().raw());
    780780
    781     AutoReaderLock chLock (childrenLock());
     781    AutoReadLock chLock (childrenLock());
    782782
    783783    for (HardDiskList::const_iterator it = children().begin();
     
    786786    {
    787787        ComObjPtr <HardDisk> child = *it;
    788         AutoLock childLock (child);
     788        AutoWriteLock childLock (child);
    789789        if (child->mReaders > 0 || child->mBusy)
    790790        {
     
    809809void HardDisk::clearBusyWithChildren()
    810810{
    811     AutoLock alock (this);
     811    AutoWriteLock alock (this);
    812812    AssertReturn (isReady(), (void) 0);
    813813
    814814    AssertReturn (mBusy == true, (void) 0);
    815815
    816     AutoReaderLock chLock (childrenLock());
     816    AutoReadLock chLock (childrenLock());
    817817
    818818    for (HardDiskList::const_iterator it = children().begin();
     
    821821    {
    822822        ComObjPtr <HardDisk> child = *it;
    823         AutoLock childLock (child);
     823        AutoWriteLock childLock (child);
    824824        Assert (child->mBusy == true);
    825825        child->mBusy = false;
     
    837837{
    838838    /* getAccessible() needs a write lock */
    839     AutoLock alock (this);
     839    AutoWriteLock alock (this);
    840840    AssertReturn (isReady(), E_FAIL);
    841841
     
    844844        return rc;
    845845
    846     AutoReaderLock chLock (childrenLock());
     846    AutoReadLock chLock (childrenLock());
    847847
    848848    for (HardDiskList::const_iterator it = children().begin();
     
    872872HRESULT HardDisk::checkConsistency()
    873873{
    874     AutoReaderLock alock (this);
     874    AutoReadLock alock (this);
    875875    AssertReturn (isReady(), E_FAIL);
    876876
     
    889889    HRESULT rc = S_OK;
    890890
    891     AutoReaderLock chLock (childrenLock());
     891    AutoReadLock chLock (childrenLock());
    892892
    893893    if (mParent.isNull() && mType == HardDiskType_Normal &&
     
    941941                  E_FAIL);
    942942
    943     AutoLock alock (this);
     943    AutoWriteLock alock (this);
    944944    CHECK_READY();
    945945
     
    10191019    AssertReturnVoid (aNewPath);
    10201020
    1021     AutoLock alock (this);
     1021    AutoWriteLock alock (this);
    10221022    AssertReturnVoid (isReady());
    10231023
     
    10251025
    10261026    /* update paths of all children */
    1027     AutoReaderLock chLock (childrenLock());
     1027    AutoReadLock chLock (childrenLock());
    10281028    for (HardDiskList::const_iterator it = children().begin();
    10291029         it != children().end();
     
    12961296
    12971297    /* save all children */
    1298     AutoReaderLock chLock (childrenLock());
     1298    AutoReadLock chLock (childrenLock());
    12991299    for (HardDiskList::const_iterator it = children().begin();
    13001300         it != children().end();
     
    13021302    {
    13031303        ComObjPtr <HardDisk> child = *it;
    1304         AutoReaderLock childLock (child);
     1304        AutoReadLock childLock (child);
    13051305
    13061306        Key hdNode = aHDNode.appendKey ("DiffHardDisk");
     
    13691369    AssertReturn (!aHDNode.isNull() && !aVDINode.isNull(), E_FAIL);
    13701370
    1371     AutoLock alock (this);
     1371    AutoWriteLock alock (this);
    13721372    ComAssertRet (!isReady(), E_UNEXPECTED);
    13731373
     
    14281428                      aFilePath, aRegistered));
    14291429
    1430     AutoLock alock (this);
     1430    AutoWriteLock alock (this);
    14311431    ComAssertRet (!isReady(), E_UNEXPECTED);
    14321432
     
    14941494    LogFlowThisFunc (("\n"));
    14951495
    1496     AutoLock alock (this);
     1496    AutoWriteLock alock (this);
    14971497    if (!isReady())
    14981498        return;
     
    15091509        return E_POINTER;
    15101510
    1511     AutoReaderLock alock (this);
     1511    AutoReadLock alock (this);
    15121512    CHECK_READY();
    15131513
     
    15181518STDMETHODIMP HVirtualDiskImage::COMSETTER(Description) (INPTR BSTR aDescription)
    15191519{
    1520     AutoLock alock (this);
     1520    AutoWriteLock alock (this);
    15211521    CHECK_READY();
    15221522
     
    15421542        return E_POINTER;
    15431543
    1544     AutoReaderLock alock (this);
     1544    AutoReadLock alock (this);
    15451545    CHECK_READY();
    15461546
     
    15581558        return E_POINTER;
    15591559
    1560     AutoReaderLock alock (this);
     1560    AutoReadLock alock (this);
    15611561    CHECK_READY();
    15621562
     
    15731573        return E_POINTER;
    15741574
    1575     AutoReaderLock alock (this);
     1575    AutoReadLock alock (this);
    15761576    CHECK_READY();
    15771577
     
    15821582STDMETHODIMP HVirtualDiskImage::COMSETTER(FilePath) (INPTR BSTR aFilePath)
    15831583{
    1584     AutoLock alock (this);
     1584    AutoWriteLock alock (this);
    15851585    CHECK_READY();
    15861586
     
    15991599        if (!RTPathHavePath (fp))
    16001600        {
    1601             AutoReaderLock propsLock (mVirtualBox->systemProperties());
     1601            AutoReadLock propsLock (mVirtualBox->systemProperties());
    16021602            path = Utf8StrFmt ("%ls%c%s",
    16031603                               mVirtualBox->systemProperties()->defaultVDIFolder().raw(),
     
    16151615        return E_POINTER;
    16161616
    1617     AutoReaderLock alock (this);
     1617    AutoReadLock alock (this);
    16181618    CHECK_READY();
    16191619
     
    16301630        return E_POINTER;
    16311631
    1632     AutoLock alock (this);
     1632    AutoWriteLock alock (this);
    16331633    CHECK_READY();
    16341634
     
    16411641        return E_POINTER;
    16421642
    1643     AutoLock alock (this);
     1643    AutoWriteLock alock (this);
    16441644    CHECK_READY();
    16451645
     
    16491649STDMETHODIMP HVirtualDiskImage::DeleteImage()
    16501650{
    1651     AutoLock alock (this);
     1651    AutoWriteLock alock (this);
    16521652    CHECK_READY();
    16531653    CHECK_BUSY_AND_READERS();
     
    16821682HRESULT HVirtualDiskImage::trySetRegistered (BOOL aRegistered)
    16831683{
    1684     AutoLock alock (this);
     1684    AutoWriteLock alock (this);
    16851685    CHECK_READY();
    16861686
     
    17171717{
    17181718    /* queryInformation() needs a write lock */
    1719     AutoLock alock (this);
     1719    AutoWriteLock alock (this);
    17201720    CHECK_READY();
    17211721
     
    17731773    AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL);
    17741774
    1775     AutoReaderLock alock (this);
     1775    AutoReadLock alock (this);
    17761776    CHECK_READY();
    17771777
     
    17981798    AssertReturnVoid (aNewPath);
    17991799
    1800     AutoLock alock (this);
     1800    AutoWriteLock alock (this);
    18011801    AssertReturnVoid (isReady());
    18021802
     
    18331833Bstr HVirtualDiskImage::toString (bool aShort /* = false */)
    18341834{
    1835     AutoReaderLock alock (this);
     1835    AutoReadLock alock (this);
    18361836
    18371837    if (!aShort)
     
    18681868    AssertReturn (aProgress, E_FAIL);
    18691869
    1870     AutoLock alock (this);
     1870    AutoWriteLock alock (this);
    18711871    AssertReturn (isReady(), E_FAIL);
    18721872
     
    19241924    AssertReturn (!aTargetPath.isNull(), E_FAIL);
    19251925
    1926     AutoLock alock (this);
     1926    AutoWriteLock alock (this);
    19271927    AssertReturn (isReady(), E_FAIL);
    19281928
     
    19791979                  E_FAIL);
    19801980
    1981     AutoLock alock (this);
     1981    AutoWriteLock alock (this);
    19821982    CHECK_READY();
    19831983
     
    20942094    LogFlowThisFunc (("mFilePathFull='%ls'\n", mFilePathFull.raw()));
    20952095
    2096     AutoLock alock (this);
     2096    AutoWriteLock alock (this);
    20972097    CHECK_READY();
    20982098
    20992099    AssertReturn (!mParent.isNull(), E_FAIL);
    2100     AutoLock parentLock (mParent);
     2100    AutoWriteLock parentLock (mParent);
    21012101
    21022102    ComAssertRet (isBusy() == true, E_FAIL);
     
    21272127        HRESULT rc = S_OK;
    21282128
    2129         AutoReaderLock chLock (childrenLock());
     2129        AutoReadLock chLock (childrenLock());
    21302130
    21312131        for (HardDiskList::const_iterator it = children().begin();
     
    21332133        {
    21342134            ComObjPtr <HVirtualDiskImage> child = (*it)->asVDI();
    2135             AutoLock childLock (child);
     2135            AutoWriteLock childLock (child);
    21362136
    21372137            /* reparent the child */
     
    22082208    LogFlowThisFunc (("mFilePathFull='%ls'\n", mFilePathFull.raw()));
    22092209
    2210     AutoLock alock (this);
     2210    AutoWriteLock alock (this);
    22112211    CHECK_READY();
    22122212
     
    22232223        HRESULT rc = S_OK;
    22242224
    2225         AutoLock chLock (childrenLock());
     2225        AutoWriteLock chLock (childrenLock ());
    22262226
    22272227        /* iterate over a copy since we will modify the list */
     
    22332233            ComObjPtr <HardDisk> hd = *it;
    22342234            ComObjPtr <HVirtualDiskImage> child = hd->asVDI();
    2235             AutoLock childLock (child);
     2235            AutoWriteLock childLock (child);
    22362236
    22372237            ComAssertRet (child->isBusy() == true, E_FAIL);
     
    23072307HRESULT HVirtualDiskImage::wipeOutImage()
    23082308{
    2309     AutoLock alock (this);
     2309    AutoWriteLock alock (this);
    23102310    CHECK_READY();
    23112311
     
    23422342HRESULT HVirtualDiskImage::deleteImage (bool aIgnoreErrors /* = false */)
    23432343{
    2344     AutoLock alock (this);
     2344    AutoWriteLock alock (this);
    23452345    CHECK_READY();
    23462346
     
    24012401HRESULT HVirtualDiskImage::queryInformation (Bstr *aAccessError)
    24022402{
    2403     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     2403    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    24042404
    24052405    /* create a lock object to completely release it later */
    2406     AutoLock alock (this);
     2406    AutoWriteLock alock (this);
    24072407
    24082408    AssertReturn (mStateCheckWaiters == 0, E_FAIL);
     
    24612461        {
    24622462            /* check parent UUID */
    2463             AutoLock parentLock (mParent);
     2463            AutoWriteLock parentLock (mParent);
    24642464            if (mParent->id() != parentId)
    24652465            {
     
    25772577                                        IProgress **aProgress)
    25782578{
    2579     AutoLock alock (this);
     2579    AutoWriteLock alock (this);
    25802580
    25812581    CHECK_BUSY_AND_READERS();
     
    27162716        Assert (!task->vdi->id().isEmpty());
    27172717        /// @todo (dmik) check locks
    2718         AutoLock sourceLock (task->source);
     2718        AutoWriteLock sourceLock (task->source);
    27192719        rc = task->source->cloneToImage (task->vdi->id(),
    27202720                                         Utf8Str (task->vdi->filePathFull()),
     
    27542754    LogFlowFunc (("rc=%08X\n", rc));
    27552755
    2756     AutoLock alock (task->vdi);
     2756    AutoWriteLock alock (task->vdi);
    27572757
    27582758    /* clear busy set in in HardDisk::CloneToImage() or
     
    28472847    AssertReturn (!aHDNode.isNull() && !aISCSINode.isNull(), E_FAIL);
    28482848
    2849     AutoLock alock (this);
     2849    AutoWriteLock alock (this);
    28502850    ComAssertRet (!isReady(), E_UNEXPECTED);
    28512851
     
    29112911    LogFlowThisFunc (("\n"));
    29122912
    2913     AutoLock alock (this);
     2913    AutoWriteLock alock (this);
    29142914    ComAssertRet (!isReady(), E_UNEXPECTED);
    29152915
     
    29492949    LogFlowThisFunc (("\n"));
    29502950
    2951     AutoLock alock (this);
     2951    AutoWriteLock alock (this);
    29522952    if (!isReady())
    29532953        return;
     
    29642964        return E_POINTER;
    29652965
    2966     AutoReaderLock alock (this);
     2966    AutoReadLock alock (this);
    29672967    CHECK_READY();
    29682968
     
    29732973STDMETHODIMP HISCSIHardDisk::COMSETTER(Description) (INPTR BSTR aDescription)
    29742974{
    2975     AutoLock alock (this);
     2975    AutoWriteLock alock (this);
    29762976    CHECK_READY();
    29772977
     
    29932993        return E_POINTER;
    29942994
    2995     AutoReaderLock alock (this);
     2995    AutoReadLock alock (this);
    29962996    CHECK_READY();
    29972997
     
    30053005        return E_POINTER;
    30063006
    3007     AutoReaderLock alock (this);
     3007    AutoReadLock alock (this);
    30083008    CHECK_READY();
    30093009
     
    30203020        return E_POINTER;
    30213021
    3022     AutoReaderLock alock (this);
     3022    AutoReadLock alock (this);
    30233023    CHECK_READY();
    30243024
     
    30323032        return E_INVALIDARG;
    30333033
    3034     AutoLock alock (this);
     3034    AutoWriteLock alock (this);
    30353035    CHECK_READY();
    30363036
     
    30523052        return E_POINTER;
    30533053
    3054     AutoReaderLock alock (this);
     3054    AutoReadLock alock (this);
    30553055    CHECK_READY();
    30563056
     
    30613061STDMETHODIMP HISCSIHardDisk::COMSETTER(Port) (USHORT aPort)
    30623062{
    3063     AutoLock alock (this);
     3063    AutoWriteLock alock (this);
    30643064    CHECK_READY();
    30653065
     
    30813081        return E_POINTER;
    30823082
    3083     AutoReaderLock alock (this);
     3083    AutoReadLock alock (this);
    30843084    CHECK_READY();
    30853085
     
    30933093        return E_INVALIDARG;
    30943094
    3095     AutoLock alock (this);
     3095    AutoWriteLock alock (this);
    30963096    CHECK_READY();
    30973097
     
    31133113        return E_POINTER;
    31143114
    3115     AutoReaderLock alock (this);
     3115    AutoReadLock alock (this);
    31163116    CHECK_READY();
    31173117
     
    31223122STDMETHODIMP HISCSIHardDisk::COMSETTER(Lun) (ULONG64 aLun)
    31233123{
    3124     AutoLock alock (this);
     3124    AutoWriteLock alock (this);
    31253125    CHECK_READY();
    31263126
     
    31423142        return E_POINTER;
    31433143
    3144     AutoReaderLock alock (this);
     3144    AutoReadLock alock (this);
    31453145    CHECK_READY();
    31463146
     
    31513151STDMETHODIMP HISCSIHardDisk::COMSETTER(UserName) (INPTR BSTR aUserName)
    31523152{
    3153     AutoLock alock (this);
     3153    AutoWriteLock alock (this);
    31543154    CHECK_READY();
    31553155
     
    31713171        return E_POINTER;
    31723172
    3173     AutoReaderLock alock (this);
     3173    AutoReadLock alock (this);
    31743174    CHECK_READY();
    31753175
     
    31803180STDMETHODIMP HISCSIHardDisk::COMSETTER(Password) (INPTR BSTR aPassword)
    31813181{
    3182     AutoLock alock (this);
     3182    AutoWriteLock alock (this);
    31833183    CHECK_READY();
    31843184
     
    32043204HRESULT HISCSIHardDisk::trySetRegistered (BOOL aRegistered)
    32053205{
    3206     AutoLock alock (this);
     3206    AutoWriteLock alock (this);
    32073207    CHECK_READY();
    32083208
     
    32283228{
    32293229   /* queryInformation() needs a write lock */
    3230     AutoLock alock (this);
     3230    AutoWriteLock alock (this);
    32313231    CHECK_READY();
    32323232
     
    32513251    AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL);
    32523252
    3253     AutoReaderLock alock (this);
     3253    AutoReadLock alock (this);
    32543254    CHECK_READY();
    32553255
     
    32833283Bstr HISCSIHardDisk::toString (bool aShort /* = false */)
    32843284{
    3285     AutoReaderLock alock (this);
     3285    AutoReadLock alock (this);
    32863286
    32873287    Bstr str;
     
    33653365HRESULT HISCSIHardDisk::queryInformation (Bstr &aAccessError)
    33663366{
    3367     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     3367    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    33683368
    33693369    /* create a lock object to completely release it later */
    3370     AutoLock alock (this);
     3370    AutoWriteLock alock (this);
    33713371
    33723372    /// @todo (dmik) query info about this iSCSI disk,
     
    34383438    AssertReturn (!aHDNode.isNull() && !aVMDKNode.isNull(), E_FAIL);
    34393439
    3440     AutoLock alock (this);
     3440    AutoWriteLock alock (this);
    34413441    ComAssertRet (!isReady(), E_UNEXPECTED);
    34423442
     
    35073507    AssertReturn (aParent == NULL, E_FAIL);
    35083508
    3509     AutoLock alock (this);
     3509    AutoWriteLock alock (this);
    35103510    ComAssertRet (!isReady(), E_UNEXPECTED);
    35113511
     
    35763576    LogFlowThisFunc (("\n"));
    35773577
    3578     AutoLock alock (this);
     3578    AutoWriteLock alock (this);
    35793579    if (!isReady())
    35803580        return;
     
    35913591        return E_POINTER;
    35923592
    3593     AutoReaderLock alock (this);
     3593    AutoReadLock alock (this);
    35943594    CHECK_READY();
    35953595
     
    36003600STDMETHODIMP HVMDKImage::COMSETTER(Description) (INPTR BSTR aDescription)
    36013601{
    3602     AutoLock alock (this);
     3602    AutoWriteLock alock (this);
    36033603    CHECK_READY();
    36043604
     
    36283628        return E_POINTER;
    36293629
    3630     AutoReaderLock alock (this);
     3630    AutoReadLock alock (this);
    36313631    CHECK_READY();
    36323632
     
    36463646        return E_POINTER;
    36473647
    3648     AutoReaderLock alock (this);
     3648    AutoReadLock alock (this);
    36493649    CHECK_READY();
    36503650
     
    36613661        return E_POINTER;
    36623662
    3663     AutoReaderLock alock (this);
     3663    AutoReadLock alock (this);
    36643664    CHECK_READY();
    36653665
     
    36703670STDMETHODIMP HVMDKImage::COMSETTER(FilePath) (INPTR BSTR aFilePath)
    36713671{
    3672     AutoLock alock (this);
     3672    AutoWriteLock alock (this);
    36733673    CHECK_READY();
    36743674
     
    36873687        if (!RTPathHavePath (fp))
    36883688        {
    3689             AutoReaderLock propsLock (mVirtualBox->systemProperties());
     3689            AutoReadLock propsLock (mVirtualBox->systemProperties());
    36903690            path = Utf8StrFmt ("%ls%c%s",
    36913691                               mVirtualBox->systemProperties()->defaultVDIFolder().raw(),
     
    37033703        return E_POINTER;
    37043704
    3705     AutoReaderLock alock (this);
     3705    AutoReadLock alock (this);
    37063706    CHECK_READY();
    37073707
     
    37183718        return E_POINTER;
    37193719
    3720     AutoLock alock (this);
     3720    AutoWriteLock alock (this);
    37213721    CHECK_READY();
    37223722
     
    37293729        return E_POINTER;
    37303730
    3731     AutoLock alock (this);
     3731    AutoWriteLock alock (this);
    37323732    CHECK_READY();
    37333733
     
    37373737STDMETHODIMP HVMDKImage::DeleteImage()
    37383738{
    3739     AutoLock alock (this);
     3739    AutoWriteLock alock (this);
    37403740    CHECK_READY();
    37413741    CHECK_BUSY_AND_READERS();
     
    37803780HRESULT HVMDKImage::trySetRegistered (BOOL aRegistered)
    37813781{
    3782     AutoLock alock (this);
     3782    AutoWriteLock alock (this);
    37833783    CHECK_READY();
    37843784
     
    38173817{
    38183818   /* queryInformation() needs a write lock */
    3819     AutoLock alock (this);
     3819    AutoWriteLock alock (this);
    38203820    CHECK_READY();
    38213821
     
    38733873    AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL);
    38743874
    3875     AutoReaderLock alock (this);
     3875    AutoReadLock alock (this);
    38763876    CHECK_READY();
    38773877
     
    38983898    AssertReturnVoid (aNewPath);
    38993899
    3900     AutoLock alock (this);
     3900    AutoWriteLock alock (this);
    39013901    AssertReturnVoid (isReady());
    39023902
     
    39333933Bstr HVMDKImage::toString (bool aShort /* = false */)
    39343934{
    3935     AutoReaderLock alock (this);
     3935    AutoReadLock alock (this);
    39363936
    39373937    if (!aShort)
     
    40324032HRESULT HVMDKImage::queryInformation (Bstr *aAccessError)
    40334033{
    4034     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     4034    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    40354035
    40364036    /* create a lock object to completely release it later */
    4037     AutoLock alock (this);
     4037    AutoWriteLock alock (this);
    40384038
    40394039    AssertReturn (mStateCheckWaiters == 0, E_FAIL);
     
    41054105        {
    41064106            /* check parent UUID */
    4107             AutoLock parentLock (mParent);
     4107            AutoWriteLock parentLock (mParent);
    41084108            if (mParent->id() != parentId)
    41094109            {
     
    43144314    AssertReturn (!aHDNode.isNull() && !aCustomNode.isNull(), E_FAIL);
    43154315
    4316     AutoLock alock (this);
     4316    AutoWriteLock alock (this);
    43174317    ComAssertRet (!isReady(), E_UNEXPECTED);
    43184318
     
    44014401    AssertReturn (aParent == NULL, E_FAIL);
    44024402
    4403     AutoLock alock (this);
     4403    AutoWriteLock alock (this);
    44044404    ComAssertRet (!isReady(), E_UNEXPECTED);
    44054405
     
    44914491    LogFlowThisFunc (("\n"));
    44924492
    4493     AutoLock alock (this);
     4493    AutoWriteLock alock (this);
    44944494    if (!isReady())
    44954495        return;
     
    45064506        return E_POINTER;
    45074507
    4508     AutoReaderLock alock (this);
     4508    AutoReadLock alock (this);
    45094509    CHECK_READY();
    45104510
     
    45154515STDMETHODIMP HCustomHardDisk::COMSETTER(Description) (INPTR BSTR aDescription)
    45164516{
    4517     AutoLock alock (this);
     4517    AutoWriteLock alock (this);
    45184518    CHECK_READY();
    45194519
     
    45284528        return E_POINTER;
    45294529
    4530     AutoReaderLock alock (this);
     4530    AutoReadLock alock (this);
    45314531    CHECK_READY();
    45324532
     
    45404540        return E_POINTER;
    45414541
    4542     AutoReaderLock alock (this);
     4542    AutoReadLock alock (this);
    45434543    CHECK_READY();
    45444544
     
    45554555        return E_POINTER;
    45564556
    4557     AutoReaderLock alock (this);
     4557    AutoReadLock alock (this);
    45584558    CHECK_READY();
    45594559
     
    45644564STDMETHODIMP HCustomHardDisk::COMSETTER(Location) (INPTR BSTR aLocation)
    45654565{
    4566     AutoLock alock (this);
     4566    AutoWriteLock alock (this);
    45674567    CHECK_READY();
    45684568
     
    45854585        if (!RTPathHavePath (fp))
    45864586        {
    4587             AutoReaderLock propsLock (mVirtualBox->systemProperties());
     4587            AutoReadLock propsLock (mVirtualBox->systemProperties());
    45884588            path = Utf8StrFmt ("%ls%c%s",
    45894589                               mVirtualBox->systemProperties()->defaultVDIFolder().raw(),
     
    46014601        return E_POINTER;
    46024602
    4603     AutoReaderLock alock (this);
     4603    AutoReadLock alock (this);
    46044604    CHECK_READY();
    46054605
     
    46134613        return E_POINTER;
    46144614
    4615     AutoReaderLock alock (this);
     4615    AutoReadLock alock (this);
    46164616    CHECK_READY();
    46174617
     
    46284628        return E_POINTER;
    46294629
    4630     AutoLock alock (this);
     4630    AutoWriteLock alock (this);
    46314631    CHECK_READY();
    46324632
     
    46394639        return E_POINTER;
    46404640
    4641     AutoLock alock (this);
     4641    AutoWriteLock alock (this);
    46424642    CHECK_READY();
    46434643
     
    46474647STDMETHODIMP HCustomHardDisk::DeleteImage()
    46484648{
    4649     AutoLock alock (this);
     4649    AutoWriteLock alock (this);
    46504650    CHECK_READY();
    46514651    CHECK_BUSY_AND_READERS();
     
    46654665HRESULT HCustomHardDisk::trySetRegistered (BOOL aRegistered)
    46664666{
    4667     AutoLock alock (this);
     4667    AutoWriteLock alock (this);
    46684668    CHECK_READY();
    46694669
     
    46954695{
    46964696   /* queryInformation() needs a write lock */
    4697     AutoLock alock (this);
     4697    AutoWriteLock alock (this);
    46984698    CHECK_READY();
    46994699
     
    47514751    AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL);
    47524752
    4753     AutoReaderLock alock (this);
     4753    AutoReadLock alock (this);
    47544754    CHECK_READY();
    47554755
     
    47754775Bstr HCustomHardDisk::toString (bool aShort /* = false */)
    47764776{
    4777     AutoReaderLock alock (this);
     4777    AutoReadLock alock (this);
    47784778
    47794779    /// @todo currently, we assume that location is always a file path for
     
    48754875HRESULT HCustomHardDisk::queryInformation (Bstr *aAccessError)
    48764876{
    4877     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     4877    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    48784878
    48794879    /* create a lock object to completely release it later */
    4880     AutoLock alock (this);
     4880    AutoWriteLock alock (this);
    48814881
    48824882    AssertReturn (mStateCheckWaiters == 0, E_FAIL);
     
    49434943        {
    49444944            /* check parent UUID */
    4945             AutoLock parentLock (mParent);
     4945            AutoWriteLock parentLock (mParent);
    49464946            if (mParent->id() != parentId)
    49474947            {
     
    51455145    AssertReturn (!aHDNode.isNull() && !aVHDNode.isNull(), E_FAIL);
    51465146
    5147     AutoLock alock (this);
     5147    AutoWriteLock alock (this);
    51485148    ComAssertRet (!isReady(), E_UNEXPECTED);
    51495149
     
    52155215    AssertReturn (aParent == NULL, E_FAIL);
    52165216
    5217     AutoLock alock (this);
     5217    AutoWriteLock alock (this);
    52185218    ComAssertRet (!isReady(), E_UNEXPECTED);
    52195219
     
    52845284    LogFlowThisFunc (("\n"));
    52855285
    5286     AutoLock alock (this);
     5286    AutoWriteLock alock (this);
    52875287    if (!isReady())
    52885288        return;
     
    52995299        return E_POINTER;
    53005300
    5301     AutoReaderLock alock (this);
     5301    AutoReadLock alock (this);
    53025302    CHECK_READY();
    53035303
     
    53085308STDMETHODIMP HVHDImage::COMSETTER(Description) (INPTR BSTR aDescription)
    53095309{
    5310     AutoLock alock (this);
     5310    AutoWriteLock alock (this);
    53115311    CHECK_READY();
    53125312
     
    53365336        return E_POINTER;
    53375337
    5338     AutoReaderLock alock (this);
     5338    AutoReadLock alock (this);
    53395339    CHECK_READY();
    53405340
     
    53545354        return E_POINTER;
    53555355
    5356     AutoReaderLock alock (this);
     5356    AutoReadLock alock (this);
    53575357    CHECK_READY();
    53585358
     
    53695369        return E_POINTER;
    53705370
    5371     AutoReaderLock alock (this);
     5371    AutoReadLock alock (this);
    53725372    CHECK_READY();
    53735373
     
    53785378STDMETHODIMP HVHDImage::COMSETTER(FilePath) (INPTR BSTR aFilePath)
    53795379{
    5380     AutoLock alock (this);
     5380    AutoWriteLock alock (this);
    53815381    CHECK_READY();
    53825382
     
    53955395        if (!RTPathHavePath (fp))
    53965396        {
    5397             AutoReaderLock propsLock (mVirtualBox->systemProperties());
     5397            AutoReadLock propsLock (mVirtualBox->systemProperties());
    53985398            path = Utf8StrFmt ("%ls%c%s",
    53995399                               mVirtualBox->systemProperties()->defaultVDIFolder().raw(),
     
    54115411        return E_POINTER;
    54125412
    5413     AutoReaderLock alock (this);
     5413    AutoReadLock alock (this);
    54145414    CHECK_READY();
    54155415
     
    54265426        return E_POINTER;
    54275427
    5428     AutoLock alock (this);
     5428    AutoWriteLock alock (this);
    54295429    CHECK_READY();
    54305430
     
    54375437        return E_POINTER;
    54385438
    5439     AutoLock alock (this);
     5439    AutoWriteLock alock (this);
    54405440    CHECK_READY();
    54415441
     
    54455445STDMETHODIMP HVHDImage::DeleteImage()
    54465446{
    5447     AutoLock alock (this);
     5447    AutoWriteLock alock (this);
    54485448    CHECK_READY();
    54495449    CHECK_BUSY_AND_READERS();
     
    54885488HRESULT HVHDImage::trySetRegistered (BOOL aRegistered)
    54895489{
    5490     AutoLock alock (this);
     5490    AutoWriteLock alock (this);
    54915491    CHECK_READY();
    54925492
     
    55255525{
    55265526    /* queryInformation() needs a write lock */
    5527     AutoLock alock (this);
     5527    AutoWriteLock alock (this);
    55285528    CHECK_READY();
    55295529
     
    55805580    AssertReturn (!aHDNode.isNull() && !aStorageNode.isNull(), E_FAIL);
    55815581
    5582     AutoReaderLock alock (this);
     5582    AutoReadLock alock (this);
    55835583    CHECK_READY();
    55845584
     
    56055605    AssertReturnVoid (aNewPath);
    56065606
    5607     AutoLock alock (this);
     5607    AutoWriteLock alock (this);
    56085608    AssertReturnVoid (isReady());
    56095609
     
    56405640Bstr HVHDImage::toString (bool aShort /* = false */)
    56415641{
    5642     AutoReaderLock alock (this);
     5642    AutoReadLock alock (this);
    56435643
    56445644    if (!aShort)
     
    57395739HRESULT HVHDImage::queryInformation (Bstr *aAccessError)
    57405740{
    5741     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     5741    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    57425742
    57435743    /* create a lock object to completely release it later */
    5744     AutoLock alock (this);
     5744    AutoWriteLock alock (this);
    57455745
    57465746    AssertReturn (mStateCheckWaiters == 0, E_FAIL);
     
    58125812        {
    58135813            /* check parent UUID */
    5814             AutoLock parentLock (mParent);
     5814            AutoWriteLock parentLock (mParent);
    58155815            if (mParent->id() != parentId)
    58165816            {
  • trunk/src/VBox/Main/HostImpl.cpp

    r7964 r8083  
    135135    ComAssertRet (parent, E_INVALIDARG);
    136136
    137     AutoLock lock(this);
     137    AutoWriteLock alock (this);
    138138    ComAssertRet (!isReady(), E_UNEXPECTED);
    139139
     
    202202    if (!drives)
    203203        return E_POINTER;
    204     AutoLock lock(this);
     204    AutoWriteLock alock (this);
    205205    CHECK_READY();
    206206    std::list <ComObjPtr <HostDVDDrive> > list;
     
    351351    if (!drives)
    352352        return E_POINTER;
    353     AutoLock lock(this);
     353    AutoWriteLock alock (this);
    354354    CHECK_READY();
    355355
     
    504504    if (!networkInterfaces)
    505505        return E_POINTER;
    506     AutoLock lock(this);
     506    AutoWriteLock alock (this);
    507507    CHECK_READY();
    508508
     
    579579        return E_POINTER;
    580580
    581     AutoLock alock (this);
     581    AutoWriteLock alock (this);
    582582    CHECK_READY();
    583583
     
    605605        return E_POINTER;
    606606
    607     AutoLock alock (this);
     607    AutoWriteLock alock (this);
    608608    CHECK_READY();
    609609
     
    635635    if (!count)
    636636        return E_POINTER;
    637     AutoLock lock(this);
     637    AutoWriteLock alock (this);
    638638    CHECK_READY();
    639639    *count = RTSystemProcessorGetCount();
     
    651651    if (!speed)
    652652        return E_POINTER;
    653     AutoLock lock(this);
     653    AutoWriteLock alock (this);
    654654    CHECK_READY();
    655655    /** @todo Add a runtime function for this which uses GIP. */
     
    666666    if (!description)
    667667        return E_POINTER;
    668     AutoLock lock(this);
     668    AutoWriteLock alock (this);
    669669    CHECK_READY();
    670670    /** @todo */
     
    683683    if (!size)
    684684        return E_POINTER;
    685     AutoLock lock(this);
     685    AutoWriteLock alock (this);
    686686    CHECK_READY();
    687687    /** @todo */
     
    699699    if (!available)
    700700        return E_POINTER;
    701     AutoLock lock(this);
     701    AutoWriteLock alock (this);
    702702    CHECK_READY();
    703703    /** @todo */
     
    715715    if (!os)
    716716        return E_POINTER;
    717     AutoLock lock(this);
     717    AutoWriteLock alock (this);
    718718    CHECK_READY();
    719719    /** @todo */
     
    731731    if (!version)
    732732        return E_POINTER;
    733     AutoLock lock(this);
     733    AutoWriteLock alock (this);
    734734    CHECK_READY();
    735735    /** @todo */
     
    747747    if (!aUTCTime)
    748748        return E_POINTER;
    749     AutoLock lock(this);
     749    AutoWriteLock alock (this);
    750750    CHECK_READY();
    751751    RTTIMESPEC now;
     
    829829        return E_POINTER;
    830830
    831     AutoLock lock (this);
     831    AutoWriteLock alock (this);
    832832    CHECK_READY();
    833833
     
    893893        return E_POINTER;
    894894
    895     AutoLock lock (this);
     895    AutoWriteLock alock (this);
    896896    CHECK_READY();
    897897
     
    956956        return E_INVALIDARG;
    957957
    958     AutoLock lock (this);
     958    AutoWriteLock alock (this);
    959959    CHECK_READY();
    960960
     
    980980        return E_INVALIDARG;
    981981
    982     AutoLock alock (this);
     982    AutoWriteLock alock (this);
    983983    CHECK_READY();
    984984
     
    10271027        return E_POINTER;
    10281028
    1029     AutoLock alock (this);
     1029    AutoWriteLock alock (this);
    10301030    CHECK_READY();
    10311031
     
    10821082    using namespace settings;
    10831083
    1084     AutoLock lock (this);
     1084    AutoWriteLock alock (this);
    10851085    CHECK_READY();
    10861086
     
    11441144    using namespace settings;
    11451145
    1146     AutoLock lock (this);
     1146    AutoWriteLock alock (this);
    11471147    CHECK_READY();
    11481148
     
    11601160    while (it != mUSBDeviceFilters.end())
    11611161    {
    1162         AutoLock filterLock (*it);
     1162        AutoWriteLock filterLock (*it);
    11631163        const HostUSBDeviceFilter::Data &data = (*it)->data();
    11641164
     
    12231223                                       BOOL aActiveChanged /* = FALSE */)
    12241224{
    1225     AutoLock alock (this);
     1225    AutoWriteLock alock (this);
    12261226    CHECK_READY();
    12271227
     
    12771277    ComAssertRet (aMachine, E_INVALIDARG);
    12781278
    1279     AutoLock lock (this);
     1279    AutoWriteLock alock (this);
    12801280    CHECK_READY();
    12811281
     
    12961296            id.raw());
    12971297
    1298     AutoLock devLock (device);
     1298    AutoWriteLock devLock (device);
    12991299
    13001300    if (device->isStatePending())
     
    13191319    {
    13201320        /* Machine::name() requires a read lock */
    1321         AutoReaderLock machLock (device->machine());
     1321        AutoReadLock machLock (device->machine());
    13221322
    13231323        return setError (E_INVALIDARG,
     
    13571357    LogFlowThisFunc (("aMachine=%p, aId={%Vuuid}\n", aMachine, Guid (aId).raw()));
    13581358
    1359     AutoLock lock (this);
     1359    AutoWriteLock alock (this);
    13601360    CHECK_READY();
    13611361
     
    13711371    ComAssertRet (!!device, E_FAIL);
    13721372
    1373     AutoLock devLock (device);
     1373    AutoWriteLock devLock (device);
    13741374
    13751375    LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d aDone=%RTbool\n",
     
    14391439    LogFlowThisFunc (("aMachine=%p\n", aMachine));
    14401440
    1441     AutoLock lock (this);
     1441    AutoWriteLock alock (this);
    14421442    CHECK_READY();
    14431443
     
    14481448        ComObjPtr <HostUSBDevice> device = *it;
    14491449
    1450         AutoLock devLock (device);
     1450        AutoWriteLock devLock (device);
    14511451
    14521452        /* skip pending devices */
     
    14781478HRESULT Host::detachAllUSBDevices (SessionMachine *aMachine, BOOL aDone)
    14791479{
    1480     AutoLock lock (this);
     1480    AutoWriteLock alock (this);
    14811481    CHECK_READY();
    14821482
     
    14861486        ComObjPtr <HostUSBDevice> device = *it;
    14871487
    1488         AutoLock devLock (device);
     1488        AutoWriteLock devLock (device);
    14891489
    14901490        if (device->machine() == aMachine)
     
    20232023
    20242024    /// @todo must check for read lock, it's enough here
    2025     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
    2026 
    2027     AssertReturn (aDevice->isLockedOnCurrentThread(), E_FAIL);
     2025    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
     2026
     2027    AssertReturn (aDevice->isWriteLockOnCurrentThread(), E_FAIL);
    20282028
    20292029    AssertReturn (aDevice->state() != USBDeviceState_Captured, E_FAIL);
     
    20492049    for (; it != mUSBDeviceFilters.end(); ++ it)
    20502050    {
    2051         AutoLock filterLock (*it);
     2051        AutoWriteLock filterLock (*it);
    20522052        const HostUSBDeviceFilter::Data &data = (*it)->data();
    20532053        if (aDevice->isMatch (data))
     
    21192119
    21202120    /// @todo must check for read lock, it's enough here
    2121     AssertReturn (isLockedOnCurrentThread(), false);
    2122 
    2123     AssertReturn (aDevice->isLockedOnCurrentThread(), false);
     2121    AssertReturn (isWriteLockOnCurrentThread(), false);
     2122
     2123    AssertReturn (aDevice->isWriteLockOnCurrentThread(), false);
    21242124
    21252125    AssertReturn (aDevice->state() != USBDeviceState_NotSupported, false);
     
    21522152    AssertReturnVoid (aDevice);
    21532153
    2154     AssertReturnVoid (isLockedOnCurrentThread());
    2155     AssertReturnVoid (aDevice->isLockedOnCurrentThread());
     2154    AssertReturnVoid (isWriteLockOnCurrentThread());
     2155    AssertReturnVoid (aDevice->isWriteLockOnCurrentThread());
    21562156
    21572157    LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
     
    21822182    AssertReturnVoid (aDevice);
    21832183
    2184     AssertReturnVoid (isLockedOnCurrentThread());
    2185     AssertReturnVoid (aDevice->isLockedOnCurrentThread());
     2184    AssertReturnVoid (isWriteLockOnCurrentThread());
     2185    AssertReturnVoid (aDevice->isWriteLockOnCurrentThread());
    21862186
    21872187    LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
     
    22262226    AssertReturnVoid (aDevice);
    22272227
    2228     AssertReturnVoid (isLockedOnCurrentThread());
    2229     AssertReturnVoid (aDevice->isLockedOnCurrentThread());
     2228    AssertReturnVoid (isWriteLockOnCurrentThread());
     2229    AssertReturnVoid (aDevice->isWriteLockOnCurrentThread());
    22302230
    22312231    LogFlowThisFunc (("id={%Vuuid} state=%d isStatePending=%RTbool pendingState=%d\n",
     
    22942294{
    22952295#ifdef VBOX_WITH_USB
    2296     AutoLock lock (this);
     2296    AutoWriteLock alock (this);
    22972297    CHECK_READY();
    22982298
  • trunk/src/VBox/Main/HostNetworkInterfaceImpl.cpp

    r5999 r8083  
    4343    ComAssertRet (!guid.isEmpty(), E_INVALIDARG);
    4444
    45     AutoLock lock(this);
     45    AutoWriteLock alock (this);
    4646    mInterfaceName = interfaceName;
    4747    mGuid = guid;
     
    6363    if (!interfaceName)
    6464        return E_POINTER;
    65     AutoLock lock(this);
     65    AutoWriteLock alock (this);
    6666    CHECK_READY();
    6767    mInterfaceName.cloneTo(interfaceName);
     
    7979    if (!guid)
    8080        return E_POINTER;
    81     AutoLock lock(this);
     81    AutoWriteLock alock (this);
    8282    CHECK_READY();
    8383    mGuid.cloneTo(guid);
  • trunk/src/VBox/Main/KeyboardImpl.cpp

    r5999 r8083  
    8282    ComAssertRet (parent, E_INVALIDARG);
    8383
    84     AutoLock alock (this);
     84    AutoWriteLock alock (this);
    8585    ComAssertRet (!isReady(), E_UNEXPECTED);
    8686
     
    9999    LogFlow(("Keyboard::uninit(): isReady=%d\n", isReady()));
    100100
    101     AutoLock alock (this);
     101    AutoWriteLock alock (this);
    102102    AssertReturn (isReady(), (void) 0);
    103103
     
    119119STDMETHODIMP Keyboard::PutScancode(LONG scancode)
    120120{
    121     AutoLock alock (this);
     121    AutoWriteLock alock (this);
    122122    CHECK_READY();
    123123
     
    151151        return E_INVALIDARG;
    152152
    153     AutoLock alock (this);
     153    AutoWriteLock alock (this);
    154154    CHECK_READY();
    155155
     
    236236    if (pData->pKeyboard)
    237237    {
    238         AutoLock kbdLock (pData->pKeyboard);
     238        AutoWriteLock kbdLock (pData->pKeyboard);
    239239        pData->pKeyboard->mpDrv = NULL;
    240240        pData->pKeyboard->mpVMMDev = NULL;
  • trunk/src/VBox/Main/MachineDebuggerImpl.cpp

    r7990 r8083  
    7070    ComAssertRet (parent, E_INVALIDARG);
    7171
    72     AutoLock lock(this);
     72    AutoWriteLock alock (this);
    7373    ComAssertRet (!isReady(), E_UNEXPECTED);
    7474
     
    9494    LogFlow(("MachineDebugger::uninit(): isReady=%d\n", isReady()));
    9595
    96     AutoLock lock(this);
     96    AutoWriteLock alock (this);
    9797    AssertReturn (isReady(), (void) 0);
    9898
     
    110110    if (!enabled)
    111111        return E_POINTER;
    112     AutoLock lock(this);
     112    AutoWriteLock alock (this);
    113113    CHECK_READY();
    114114    /** @todo */
     
    124124STDMETHODIMP MachineDebugger::COMSETTER(Singlestep)(BOOL enable)
    125125{
    126     AutoLock lock(this);
     126    AutoWriteLock alock (this);
    127127    CHECK_READY();
    128128    /** @todo */
     
    197197    if (!enabled)
    198198        return E_POINTER;
    199     AutoLock lock(this);
     199    AutoWriteLock alock (this);
    200200    CHECK_READY();
    201201    Console::SafeVMPtrQuiet pVM (mParent);
     
    217217    LogFlowThisFunc (("enable=%d\n", enable));
    218218
    219     AutoLock lock(this);
     219    AutoWriteLock alock (this);
    220220    CHECK_READY();
    221221
     
    264264    if (!enabled)
    265265        return E_POINTER;
    266     AutoLock lock(this);
     266    AutoWriteLock alock (this);
    267267    CHECK_READY();
    268268    Console::SafeVMPtrQuiet pVM (mParent);
     
    284284    LogFlowThisFunc (("enable=%d\n", enable));
    285285
    286     AutoLock lock(this);
     286    AutoWriteLock alock (this);
    287287    CHECK_READY();
    288288
     
    331331    if (!enabled)
    332332        return E_POINTER;
    333     AutoLock lock(this);
     333    AutoWriteLock alock (this);
    334334    CHECK_READY();
    335335    Console::SafeVMPtrQuiet pVM (mParent);
     
    349349STDMETHODIMP MachineDebugger::COMSETTER(PATMEnabled)(BOOL enable)
    350350{
    351     AutoLock lock(this);
     351    AutoWriteLock alock (this);
    352352    CHECK_READY();
    353353    LogFlowThisFunc (("enable=%d\n", enable));
     
    383383    if (!enabled)
    384384        return E_POINTER;
    385     AutoLock lock(this);
     385    AutoWriteLock alock (this);
    386386    CHECK_READY();
    387387    Console::SafeVMPtrQuiet pVM (mParent);
     
    401401STDMETHODIMP MachineDebugger::COMSETTER(CSAMEnabled)(BOOL enable)
    402402{
    403     AutoLock lock(this);
     403    AutoWriteLock alock (this);
    404404    CHECK_READY();
    405405    LogFlowThisFunc (("enable=%d\n", enable));
     
    443443    if (!aEnabled)
    444444        return E_POINTER;
    445     AutoLock alock(this);
     445    AutoWriteLock alock(this);
    446446    CHECK_READY();
    447447    PRTLOGGER pLogInstance = RTLogDefaultInstance();
     
    458458STDMETHODIMP MachineDebugger::COMSETTER(LogEnabled)(BOOL aEnabled)
    459459{
    460     AutoLock alock(this);
     460    AutoWriteLock alock(this);
    461461
    462462    CHECK_READY();
     
    498498        return E_POINTER;
    499499
    500     AutoLock lock(this);
     500    AutoWriteLock alock (this);
    501501    CHECK_READY();
    502502
     
    520520        return E_POINTER;
    521521
    522     AutoLock lock(this);
     522    AutoWriteLock alock (this);
    523523    CHECK_READY();
    524524
     
    545545        return E_POINTER;
    546546
    547     AutoLock lock(this);
     547    AutoWriteLock alock (this);
    548548    CHECK_READY();
    549549
     
    567567        return E_INVALIDARG;
    568568
    569     AutoLock lock(this);
     569    AutoWriteLock alock (this);
    570570    CHECK_READY();
    571571
     
    608608        return E_POINTER;
    609609
    610     AutoLock lock(this);
     610    AutoWriteLock alock (this);
    611611    CHECK_READY();
    612612
  • trunk/src/VBox/Main/MachineImpl.cpp

    r8055 r8083  
    599599    LogFlowThisFuncEnter();
    600600
    601     Assert (!isLockedOnCurrentThread());
     601    Assert (!isWriteLockOnCurrentThread());
    602602
    603603    /* Enclose the state transition Ready->InUninit->NotReady */
     
    703703    CheckComRCReturnRC (autoCaller.rc());
    704704
    705     AutoLock alock (this);
     705    AutoWriteLock alock (this);
    706706
    707707    HRESULT rc = S_OK;
     
    734734    CheckComRCReturnRC (autoCaller.rc());
    735735
    736     AutoReaderLock alock (this);
     736    AutoReadLock alock (this);
    737737
    738738    if (mData->mAccessible || !mData->mAccessError.isBasicAvailable())
     
    767767    CheckComRCReturnRC (autoCaller.rc());
    768768
    769     AutoReaderLock alock (this);
     769    AutoReadLock alock (this);
    770770
    771771    mUserData->mName.cloneTo (aName);
     
    786786    CheckComRCReturnRC (autoCaller.rc());
    787787
    788     AutoLock alock (this);
     788    AutoWriteLock alock (this);
    789789
    790790    HRESULT rc = checkStateDependency (MutableStateDep);
     
    805805    CheckComRCReturnRC (autoCaller.rc());
    806806
    807     AutoReaderLock alock (this);
     807    AutoReadLock alock (this);
    808808
    809809    mUserData->mDescription.cloneTo (aDescription);
     
    817817    CheckComRCReturnRC (autoCaller.rc());
    818818
    819     AutoLock alock (this);
     819    AutoWriteLock alock (this);
    820820
    821821    HRESULT rc = checkStateDependency (MutableStateDep);
     
    836836    CheckComRCReturnRC (autoCaller.rc());
    837837
    838     AutoReaderLock alock (this);
     838    AutoReadLock alock (this);
    839839
    840840    mData->mUuid.cloneTo (aId);
     
    851851    CheckComRCReturnRC (autoCaller.rc());
    852852
    853     AutoReaderLock alock (this);
     853    AutoReadLock alock (this);
    854854
    855855    mUserData->mOSTypeId.cloneTo (aOSTypeId);
     
    872872    CheckComRCReturnRC (rc);
    873873
    874     AutoLock alock (this);
     874    AutoWriteLock alock (this);
    875875
    876876    rc = checkStateDependency (MutableStateDep);
     
    891891    CheckComRCReturnRC (autoCaller.rc());
    892892
    893     AutoReaderLock alock (this);
     893    AutoReadLock alock (this);
    894894
    895895    *memorySize = mHWData->mMemorySize;
     
    910910    CheckComRCReturnRC (autoCaller.rc());
    911911
    912     AutoLock alock (this);
     912    AutoWriteLock alock (this);
    913913
    914914    HRESULT rc = checkStateDependency (MutableStateDep);
     
    929929    CheckComRCReturnRC (autoCaller.rc());
    930930
    931     AutoReaderLock alock (this);
     931    AutoReadLock alock (this);
    932932
    933933    *memorySize = mHWData->mVRAMSize;
     
    948948    CheckComRCReturnRC (autoCaller.rc());
    949949
    950     AutoLock alock (this);
     950    AutoWriteLock alock (this);
    951951
    952952    HRESULT rc = checkStateDependency (MutableStateDep);
     
    968968    CheckComRCReturnRC (autoCaller.rc());
    969969
    970     AutoReaderLock alock (this);
     970    AutoReadLock alock (this);
    971971
    972972    *memoryBalloonSize = mHWData->mMemoryBalloonSize;
     
    987987    CheckComRCReturnRC (autoCaller.rc());
    988988
    989     AutoLock alock (this);
     989    AutoWriteLock alock (this);
    990990
    991991    HRESULT rc = checkStateDependency (MutableStateDep);
     
    10071007    CheckComRCReturnRC (autoCaller.rc());
    10081008
    1009     AutoReaderLock alock (this);
     1009    AutoReadLock alock (this);
    10101010
    10111011    *statisticsUpdateInterval = mHWData->mStatisticsUpdateInterval;
     
    10201020    CheckComRCReturnRC (autoCaller.rc());
    10211021
    1022     AutoLock alock (this);
     1022    AutoWriteLock alock (this);
    10231023
    10241024    HRESULT rc = checkStateDependency (MutableStateDep);
     
    10401040    CheckComRCReturnRC (autoCaller.rc());
    10411041
    1042     AutoReaderLock alock (this);
     1042    AutoReadLock alock (this);
    10431043
    10441044    *monitorCount = mHWData->mMonitorCount;
     
    10581058    CheckComRCReturnRC (autoCaller.rc());
    10591059
    1060     AutoLock alock (this);
     1060    AutoWriteLock alock (this);
    10611061
    10621062    HRESULT rc = checkStateDependency (MutableStateDep);
     
    10911091    CheckComRCReturnRC (autoCaller.rc());
    10921092
    1093     AutoReaderLock alock (this);
     1093    AutoReadLock alock (this);
    10941094
    10951095    *enabled = mHWData->mHWVirtExEnabled;
     
    11031103    CheckComRCReturnRC (autoCaller.rc());
    11041104
    1105     AutoLock alock (this);
     1105    AutoWriteLock alock (this);
    11061106
    11071107    HRESULT rc = checkStateDependency (MutableStateDep);
     
    11241124    CheckComRCReturnRC (autoCaller.rc());
    11251125
    1126     AutoReaderLock alock (this);
     1126    AutoReadLock alock (this);
    11271127
    11281128    *enabled = mHWData->mPAEEnabled;
     
    11361136    CheckComRCReturnRC (autoCaller.rc());
    11371137
    1138     AutoLock alock (this);
     1138    AutoWriteLock alock (this);
    11391139
    11401140    HRESULT rc = checkStateDependency (MutableStateDep);
     
    11571157    CheckComRCReturnRC (autoCaller.rc());
    11581158
    1159     AutoReaderLock alock (this);
     1159    AutoReadLock alock (this);
    11601160
    11611161    mUserData->mSnapshotFolderFull.cloneTo (aSnapshotFolder);
     
    11771177    CheckComRCReturnRC (autoCaller.rc());
    11781178
    1179     AutoLock alock (this);
     1179    AutoWriteLock alock (this);
    11801180
    11811181    HRESULT rc = checkStateDependency (MutableStateDep);
     
    12251225    CheckComRCReturnRC (autoCaller.rc());
    12261226
    1227     AutoReaderLock alock (this);
     1227    AutoReadLock alock (this);
    12281228
    12291229    ComObjPtr <HardDiskAttachmentCollection> collection;
     
    12441244    CheckComRCReturnRC (autoCaller.rc());
    12451245
    1246     AutoReaderLock alock (this);
     1246    AutoReadLock alock (this);
    12471247
    12481248    Assert (!!mVRDPServer);
     
    12631263    CheckComRCReturnRC (autoCaller.rc());
    12641264
    1265     AutoReaderLock alock (this);
     1265    AutoReadLock alock (this);
    12661266
    12671267    Assert (!!mDVDDrive);
     
    12781278    CheckComRCReturnRC (autoCaller.rc());
    12791279
    1280     AutoReaderLock alock (this);
     1280    AutoReadLock alock (this);
    12811281
    12821282    Assert (!!mFloppyDrive);
     
    12931293    CheckComRCReturnRC (autoCaller.rc());
    12941294
    1295     AutoReaderLock alock (this);
     1295    AutoReadLock alock (this);
    12961296
    12971297    mAudioAdapter.queryInterfaceTo (audioAdapter);
     
    13111311    CheckComRCReturnRC (rc);
    13121312
    1313     AutoReaderLock alock (this);
     1313    AutoReadLock alock (this);
    13141314
    13151315    return rc = mUSBController.queryInterfaceTo (aUSBController);
     
    13311331    CheckComRCReturnRC (autoCaller.rc());
    13321332
    1333     AutoReaderLock alock (this);
     1333    AutoReadLock alock (this);
    13341334
    13351335    return mSATAController.queryInterfaceTo (aSATAController);
     
    13501350    CheckComRCReturnRC (autoCaller.rc());
    13511351
    1352     AutoReaderLock alock (this);
     1352    AutoReadLock alock (this);
    13531353
    13541354    mData->mConfigFileFull.cloneTo (aFilePath);
     
    13651365    CheckComRCReturnRC (autoCaller.rc());
    13661366
    1367     AutoReaderLock alock (this);
     1367    AutoReadLock alock (this);
    13681368
    13691369    mData->mSettingsFileVersion.cloneTo (aSettingsFileVersion);
     
    13791379    CheckComRCReturnRC (autoCaller.rc());
    13801380
    1381     AutoLock alock (this);
     1381    AutoWriteLock alock (this);
    13821382
    13831383    HRESULT rc = checkStateDependency (MutableStateDep);
     
    14081408    CheckComRCReturnRC (autoCaller.rc());
    14091409
    1410     AutoReaderLock alock (this);
     1410    AutoReadLock alock (this);
    14111411
    14121412    *aSessionState = mData->mSession.mState;
     
    14231423    CheckComRCReturnRC (autoCaller.rc());
    14241424
    1425     AutoReaderLock alock (this);
     1425    AutoReadLock alock (this);
    14261426
    14271427    mData->mSession.mType.cloneTo (aSessionType);
     
    14381438    CheckComRCReturnRC (autoCaller.rc());
    14391439
    1440     AutoReaderLock alock (this);
     1440    AutoReadLock alock (this);
    14411441
    14421442    *aSessionPid = mData->mSession.mPid;
     
    14531453    CheckComRCReturnRC (autoCaller.rc());
    14541454
    1455     AutoReaderLock alock (this);
     1455    AutoReadLock alock (this);
    14561456
    14571457    *machineState = mData->mMachineState;
     
    14681468    CheckComRCReturnRC (autoCaller.rc());
    14691469
    1470     AutoReaderLock alock (this);
     1470    AutoReadLock alock (this);
    14711471
    14721472    *aLastStateChange = RTTimeSpecGetMilli (&mData->mLastStateChange);
     
    14831483    CheckComRCReturnRC (autoCaller.rc());
    14841484
    1485     AutoReaderLock alock (this);
     1485    AutoReadLock alock (this);
    14861486
    14871487    mSSData->mStateFilePath.cloneTo (aStateFilePath);
     
    14981498    AssertComRCReturnRC (autoCaller.rc());
    14991499
    1500     AutoReaderLock alock (this);
     1500    AutoReadLock alock (this);
    15011501
    15021502    Utf8Str logFolder;
     
    15161516    CheckComRCReturnRC (autoCaller.rc());
    15171517
    1518     AutoReaderLock alock (this);
     1518    AutoReadLock alock (this);
    15191519
    15201520    mData->mCurrentSnapshot.queryInterfaceTo (aCurrentSnapshot);
     
    15311531    CheckComRCReturnRC (autoCaller.rc());
    15321532
    1533     AutoReaderLock alock (this);
     1533    AutoReadLock alock (this);
    15341534
    15351535    *aSnapshotCount = !mData->mFirstSnapshot ? 0 :
     
    15471547    CheckComRCReturnRC (autoCaller.rc());
    15481548
    1549     AutoReaderLock alock (this);
     1549    AutoReadLock alock (this);
    15501550
    15511551    /*
     
    15701570    CheckComRCReturnRC (autoCaller.rc());
    15711571
    1572     AutoReaderLock alock (this);
     1572    AutoReadLock alock (this);
    15731573
    15741574    ComObjPtr <SharedFolderCollection> coll;
     
    15891589    CheckComRCReturnRC (autoCaller.rc());
    15901590
    1591     AutoReaderLock alock (this);
     1591    AutoReadLock alock (this);
    15921592
    15931593    *aClipboardMode = mHWData->mClipboardMode;
     
    16021602    CheckComRCReturnRC (autoCaller.rc());
    16031603
    1604     AutoLock alock (this);
     1604    AutoWriteLock alock (this);
    16051605
    16061606    HRESULT rc = checkStateDependency (MutableStateDep);
     
    16301630    CheckComRCReturnRC (autoCaller.rc());
    16311631
    1632     AutoLock alock (this);
     1632    AutoWriteLock alock (this);
    16331633
    16341634    HRESULT rc = checkStateDependency (MutableStateDep);
     
    16511651    CheckComRCReturnRC (autoCaller.rc());
    16521652
    1653     AutoReaderLock alock (this);
     1653    AutoReadLock alock (this);
    16541654
    16551655    *aDevice = mHWData->mBootOrder [aPosition - 1];
     
    16931693        {
    16941694            ComObjPtr <HardDisk> hd = hda->hardDisk();
    1695             AutoLock hdLock (hd);
     1695            AutoWriteLock hdLock (hd);
    16961696            return setError (E_FAIL,
    16971697                tr ("Hard disk '%ls' is already attached to device slot %d on "
     
    17121712    CheckComRCReturnRC (rc);
    17131713
    1714     AutoLock hdLock (hd);
     1714    AutoWriteLock hdLock (hd);
    17151715
    17161716    if (hd->isDifferencing())
     
    18391839    CheckComRCReturnRC (autoCaller.rc());
    18401840
    1841     AutoReaderLock alock (this);
     1841    AutoReadLock alock (this);
    18421842
    18431843    *aHardDisk = NULL;
     
    18671867    CheckComRCReturnRC (autoCaller.rc());
    18681868
    1869     AutoLock alock (this);
     1869    AutoWriteLock alock (this);
    18701870
    18711871    HRESULT rc = checkStateDependency (MutableStateDep);
     
    18851885        {
    18861886            ComObjPtr <HardDisk> hd = hda->hardDisk();
    1887             AutoLock hdLock (hd);
     1887            AutoWriteLock hdLock (hd);
    18881888
    18891889            ComAssertRet (hd->children().size() == 0 &&
     
    19611961    CheckComRCReturnRC (autoCaller.rc());
    19621962
    1963     AutoReaderLock alock (this);
     1963    AutoReadLock alock (this);
    19641964
    19651965    mSerialPorts [slot].queryInterfaceTo (port);
     
    19781978    CheckComRCReturnRC (autoCaller.rc());
    19791979
    1980     AutoReaderLock alock (this);
     1980    AutoReadLock alock (this);
    19811981
    19821982    mParallelPorts [slot].queryInterfaceTo (port);
     
    19951995    CheckComRCReturnRC (autoCaller.rc());
    19961996
    1997     AutoReaderLock alock (this);
     1997    AutoReadLock alock (this);
    19981998
    19991999    mNetworkAdapters [slot].queryInterfaceTo (adapter);
     
    20142014
    20152015    /* serialize file access (prevent writes) */
    2016     AutoReaderLock alock (this);
     2016    AutoReadLock alock (this);
    20172017
    20182018    /* start with nothing found */
     
    21192119
    21202120    /* serialize file access (prevent writes) */
    2121     AutoReaderLock alock (this);
     2121    AutoReadLock alock (this);
    21222122
    21232123    /* start with nothing found */
     
    23482348    CheckComRCReturnRC (autoCaller.rc());
    23492349
    2350     AutoLock alock (this);
     2350    AutoWriteLock alock (this);
    23512351
    23522352    HRESULT rc = checkStateDependency (MutableStateDep);
     
    23672367    CheckComRCReturnRC (autoCaller.rc());
    23682368
    2369     AutoLock alock (this);
     2369    AutoWriteLock alock (this);
    23702370
    23712371    HRESULT rc = checkStateDependency (MutableStateDep);
     
    24422442    CheckComRCReturnRC (autoCaller.rc());
    24432443
    2444     AutoReaderLock alock (this);
     2444    AutoReadLock alock (this);
    24452445
    24462446    Guid id = aId;
     
    24632463    CheckComRCReturnRC (autoCaller.rc());
    24642464
    2465     AutoReaderLock alock (this);
     2465    AutoReadLock alock (this);
    24662466
    24672467    ComObjPtr <Snapshot> snapshot;
     
    24902490    CheckComRCReturnRC (autoCaller.rc());
    24912491
    2492     AutoLock alock (this);
     2492    AutoWriteLock alock (this);
    24932493
    24942494    HRESULT rc = checkStateDependency (MutableStateDep);
     
    25312531    CheckComRCReturnRC (autoCaller.rc());
    25322532
    2533     AutoLock alock (this);
     2533    AutoWriteLock alock (this);
    25342534
    25352535    HRESULT rc = checkStateDependency (MutableStateDep);
     
    25632563    ComPtr <IInternalSessionControl> directControl;
    25642564    {
    2565         AutoReaderLock alock (this);
     2565        AutoReadLock alock (this);
    25662566
    25672567        if (mData->mSession.mState != SessionState_Open)
     
    25912591    ComPtr <IInternalSessionControl> directControl;
    25922592    {
    2593         AutoReaderLock alock (this);
     2593        AutoReadLock alock (this);
    25942594
    25952595        if (mData->mSession.mState != SessionState_Open)
     
    26292629        return sm;
    26302630
    2631     AutoReaderLock alock (this);
     2631    AutoReadLock alock (this);
    26322632
    26332633    sm = mData->mSession.mMachine;
     
    26522652    AssertComRCReturnRC (autoCaller.rc());
    26532653
    2654     AutoReaderLock alock (this);
     2654    AutoReadLock alock (this);
    26552655
    26562656    /* UUID */
     
    26782678    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    26792679
    2680     AutoReaderLock alock (this);
     2680    AutoReadLock alock (this);
    26812681
    26822682    AssertReturn (!mData->mConfigFileFull.isNull(), VERR_GENERAL_FAILURE);
     
    27102710    AssertComRCReturn (autoCaller.rc(), (void) 0);
    27112711
    2712     AutoReaderLock alock (this);
     2712    AutoReadLock alock (this);
    27132713
    27142714    AssertReturnVoid (!mData->mConfigFileFull.isNull());
     
    27372737    AssertComRCReturnVoid (autoCaller.rc());
    27382738
    2739     AutoReaderLock alock (this);
     2739    AutoReadLock alock (this);
    27402740
    27412741    Utf8Str settingsDir;
     
    27722772        return false;
    27732773
    2774     AutoReaderLock alock (this);
     2774    AutoReadLock alock (this);
    27752775
    27762776    Machine *m = this;
     
    27852785        AssertReturn (!dvd.isNull(), false);
    27862786
    2787         AutoReaderLock dvdLock (dvd);
     2787        AutoReadLock dvdLock (dvd);
    27882788
    27892789        /* loop over the backed up (permanent) and current (temporary) DVD data */
     
    28482848        return false;
    28492849
    2850     AutoReaderLock alock (this);
     2850    AutoReadLock alock (this);
    28512851
    28522852    Machine *m = this;
     
    28612861        AssertReturn (!floppy.isNull(), false);
    28622862
    2863         AutoReaderLock floppyLock (floppy);
     2863        AutoReadLock floppyLock (floppy);
    28642864
    28652865        /* loop over the backed up (permanent) and current (temporary) Floppy data */
     
    31143114    CheckComRCReturnRC (autoCaller.rc());
    31153115
    3116     AutoLock alock (this);
     3116    AutoWriteLock alock (this);
    31173117
    31183118    if (!mData->mRegistered)
     
    33343334    CheckComRCReturnRC (autoCaller.rc());
    33353335
    3336     AutoLock alock (this);
     3336    AutoWriteLock alock (this);
    33373337
    33383338    if (!mData->mRegistered)
     
    34213421HRESULT Machine::trySetRegistered (BOOL aRegistered)
    34223422{
    3423     AssertReturn (mParent->isLockedOnCurrentThread(), E_FAIL);
     3423    AssertReturn (mParent->isWriteLockOnCurrentThread(), E_FAIL);
    34243424
    34253425    AutoLimitedCaller autoCaller (this);
    34263426    AssertComRCReturnRC (autoCaller.rc());
    34273427
    3428     AutoLock alock (this);
     3428    AutoWriteLock alock (this);
    34293429
    34303430    /* wait for state dependants to drop to zero */
     
    35363536    AssertComRCReturnRC (autoCaller.rc());
    35373537
    3538     AutoReaderLock alock (this);
     3538    AutoReadLock alock (this);
    35393539
    35403540    HRESULT rc = checkStateDependency (aDepType);
     
    35423542
    35433543    {
    3544         AutoLock stateLock (stateLockHandle());
     3544        AutoWriteLock stateLock (stateLockHandle());
    35453545
    35463546        if (mData->mMachineStateChangePending != 0)
     
    35803580    /* stateLockHandle() is the same handle that is used by AutoCaller
    35813581     * so lock it in advance to avoid two mutex requests in a raw */
    3582     AutoLock stateLock (stateLockHandle());
     3582    AutoWriteLock stateLock (stateLockHandle());
    35833583
    35843584    AutoCaller autoCaller (this);
     
    38803880 * @warning To be used only in methods that change the machine state!
    38813881 */
    3882 void Machine::ensureNoStateDependencies (AutoLock &aLock)
     3882void Machine::ensureNoStateDependencies (AutoWriteLock &aLock)
    38833883{
    38843884    AssertReturnVoid (aLock.belongsTo (this));
    3885     AssertReturnVoid (aLock.isLockedOnCurrentThread());
    3886 
    3887     AutoLock stateLock (stateLockHandle());
     3885    AssertReturnVoid (aLock.isWriteLockOnCurrentThread());
     3886
     3887    AutoWriteLock stateLock (stateLockHandle());
    38883888
    38893889    /* Wait for all state dependants if necessary */
     
    39283928    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    39293929
    3930     AutoLock alock (this);
     3930    AutoWriteLock alock (this);
    39313931
    39323932    /* wait for state dependants to drop to zero */
     
    39693969        ++ it)
    39703970    {
    3971         AutoLock alock (*it);
     3971        AutoWriteLock alock (*it);
    39723972        found = (*it)->name() == aName;
    39733973        if (found)
     
    45694569        CheckComRCReturnRC (rc);
    45704570
    4571         AutoLock hdLock (hd);
     4571        AutoWriteLock hdLock (hd);
    45724572
    45734573        if (!hd->machineId().isEmpty())
     
    48624862     * currently differentiate it in callers of saveSettings() so we don't
    48634863     * make difference here too.  */
    4864     AssertReturn (mParent->isLockedOnCurrentThread(), E_FAIL);
    4865     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     4864    AssertReturn (mParent->isWriteLockOnCurrentThread(), E_FAIL);
     4865    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    48664866
    48674867    HRESULT rc = S_OK;
     
    50985098     * currently differentiate it in callers of saveSettings() so we don't
    50995099     * make difference here too.  */
    5100     AssertReturn (mParent->isLockedOnCurrentThread(), E_FAIL);
    5101     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     5100    AssertReturn (mParent->isWriteLockOnCurrentThread(), E_FAIL);
     5101    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    51025102
    51035103    /// @todo (dmik) I guess we should lock all our child objects here
     
    53425342    /* This object's write lock is also necessary to serialize file access
    53435343     * (prevent concurrent reads and writes) */
    5344     AutoLock alock (this);
     5344    AutoWriteLock alock (this);
    53455345
    53465346    AssertReturn (isConfigLocked(), E_FAIL);
     
    54055405    AssertReturn (!aMachineNode.isNull(), E_FAIL);
    54065406
    5407     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     5407    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    54085408
    54095409    int op = aOpFlags & SaveSS_OpMask;
     
    56235623    /* save children */
    56245624    {
    5625         AutoLock listLock (aSnapshot->childrenLock());
     5625        AutoWriteLock listLock (aSnapshot->childrenLock ());
    56265626
    56275627        if (aSnapshot->children().size())
     
    59205920    /* This object's write lock is also necessary to serialize file access
    59215921     * (prevent concurrent reads and writes) */
    5922     AutoLock alock (this);
     5922    AutoWriteLock alock (this);
    59235923
    59245924    AssertReturn (isConfigLocked(), E_FAIL);
     
    59965996    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    59975997
    5998     AutoReaderLock alock (this);
     5998    AutoReadLock alock (this);
    59995999
    60006000    AssertReturn (mData->mMachineState == MachineState_PoweredOff ||
     
    60066006    {
    60076007        ComObjPtr <HardDisk> hd = (*it)->hardDisk();
    6008         AutoLock hdLock (hd);
     6008        AutoWriteLock hdLock (hd);
    60096009
    60106010        if(hd->isParentImmutable())
     
    60316031    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    60326032
    6033     AutoLock alock (this);
     6033    AutoWriteLock alock (this);
    60346034
    60356035    /* no attac/detach operations -- nothing to do */
     
    60646064            ComObjPtr <HardDiskAttachment> hda = *it;
    60656065            ComObjPtr <HardDisk> hd = hda->hardDisk();
    6066             AutoLock hdLock (hd);
     6066            AutoWriteLock hdLock (hd);
    60676067
    60686068            if (!hda->isDirty())
     
    62336233                    while (snap)
    62346234                    {
    6235                         AutoLock snapLock (snap);
     6235                        AutoWriteLock snapLock (snap);
    62366236
    62376237                        const HDData::HDAttachmentList &snapAtts =
     
    62796279                /* create a new diff for the hard disk being indirectly attached */
    62806280
    6281                 AutoLock baseHdLock (baseHd);
     6281                AutoWriteLock baseHdLock (baseHd);
    62826282                baseHd->addReader();
    62836283
     
    63286328            ComObjPtr <HardDiskAttachment> hda = *it;
    63296329            ComObjPtr <HardDisk> hd = hda->hardDisk();
    6330             AutoLock hdLock (hd);
     6330            AutoWriteLock hdLock (hd);
    63316331
    63326332            if (hd->isDifferencing())
     
    63716371        ComObjPtr <HardDiskAttachment> hda = *it;
    63726372        ComObjPtr <HardDisk> hd = hda->hardDisk();
    6373         AutoLock hdLock (hd);
     6373        AutoWriteLock hdLock (hd);
    63746374
    63756375        if (hda->isDirty())
     
    64636463            ComObjPtr <HardDiskAttachment> hda = *it;
    64646464            ComObjPtr <HardDisk> hd = hda->hardDisk();
    6465             AutoLock hdLock (hd);
     6465            AutoWriteLock hdLock (hd);
    64666466
    64676467            ComAssertMsgBreak (hd->type() == HardDiskType_Normal,
     
    64986498        ComObjPtr <HardDiskAttachment> hda = *it;
    64996499        ComObjPtr <HardDisk> hd = hda->hardDisk();
    6500         AutoLock hdLock (hd);
     6500        AutoWriteLock hdLock (hd);
    65016501
    65026502        ComObjPtr <HardDisk> parent = hd->parent();
    6503         AutoLock parentHdLock (parent);
     6503        AutoWriteLock parentHdLock (parent);
    65046504
    65056505        ComObjPtr <HardDisk> newHd;
     
    66096609        {
    66106610            ComObjPtr <HardDisk> hd = (*it)->hardDisk();
    6611             AutoLock hdLock (hd);
     6611            AutoWriteLock hdLock (hd);
    66126612            Assert (hd->children().size() == 0);
    66136613            Assert (hd->isDifferencing());
     
    66516651        ComObjPtr <HardDiskAttachment> hda = *it;
    66526652        ComObjPtr <HardDisk> hd = hda->hardDisk();
    6653         AutoLock hdLock (hd);
     6653        AutoWriteLock hdLock (hd);
    66546654
    66556655        ComObjPtr <HardDisk> parent = hd->parent();
    6656         AutoLock parentHdLock (parent);
     6656        AutoWriteLock parentHdLock (parent);
    66576657
    66586658        if (!parent || parent->snapshotId() != aSnapshot->data().mId)
     
    67666766    AssertComRCReturn (autoCaller.rc(), false);
    67676767
    6768     AutoReaderLock alock (this);
     6768    AutoReadLock alock (this);
    67696769
    67706770    for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)
     
    68086808    AssertComRCReturn (autoCaller.rc(), false);
    68096809
    6810     AutoReaderLock alock (this);
     6810    AutoReadLock alock (this);
    68116811
    68126812    for (ULONG slot = 0; slot < ELEMENTS (mNetworkAdapters); slot ++)
     
    68506850    AssertComRCReturn (autoCaller.rc(), (void) 0);
    68516851
    6852     AutoLock alock (this);
     6852    AutoWriteLock alock (this);
    68536853
    68546854    /* check for changes in own data */
     
    69886988    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    69896989
    6990     AutoLock alock (this);
     6990    AutoWriteLock alock (this);
    69916991
    69926992    HRESULT rc = S_OK;
     
    71937193    AssertReturn (aMachine, E_INVALIDARG);
    71947194
    7195     AssertReturn (aMachine->lockHandle()->isLockedOnCurrentThread(), E_FAIL);
     7195    AssertReturn (aMachine->lockHandle()->isWriteLockOnCurrentThread(), E_FAIL);
    71967196
    71977197    /* Enclose the state transition NotReady->InInit->Ready */
     
    75277527}
    75287528
    7529 // AutoLock::Lockable interface
     7529// util::Lockable interface
    75307530////////////////////////////////////////////////////////////////////////////////
    75317531
     
    75597559    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    75607560
    7561     AutoReaderLock alock (this);
     7561    AutoReadLock alock (this);
    75627562
    75637563#if defined(RT_OS_WINDOWS) || defined(RT_OS_OS2)
     
    78637863    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    78647864
    7865     AutoLock alock (this);
     7865    AutoWriteLock alock (this);
    78667866
    78677867    AssertReturn (mData->mMachineState == MachineState_PoweredOff ||
     
    79327932    {
    79337933        ComObjPtr <HardDisk> hd = (*it)->hardDisk();
    7934         AutoLock hdLock (hd);
     7934        AutoWriteLock hdLock (hd);
    79357935        if (hd->type() == HardDiskType_Writethrough)
    79367936            return setError (E_FAIL,
     
    81088108    CheckComRCReturnRC (rc);
    81098109
    8110     AutoLock snapshotLock (snapshot);
     8110    AutoWriteLock snapshotLock (snapshot);
    81118111    if (snapshot == mData->mFirstSnapshot)
    81128112    {
    8113         AutoLock chLock (mData->mFirstSnapshot->childrenLock());
     8113        AutoWriteLock chLock (mData->mFirstSnapshot->childrenLock ());
    81148114        size_t childrenCount = mData->mFirstSnapshot->children().size();
    81158115        if (childrenCount > 1)
     
    83568356        }
    83578357
    8358         AutoLock alock (this);
     8358        AutoWriteLock alock (this);
    83598359
    83608360        /*
     
    84308430    ComPtr <IInternalSessionControl> directControl;
    84318431    {
    8432         AutoReaderLock alock (this);
     8432        AutoReadLock alock (this);
    84338433        directControl = mData->mSession.mDirectControl;
    84348434    }
     
    84538453    ComPtr <IInternalSessionControl> directControl;
    84548454    {
    8455         AutoReaderLock alock (this);
     8455        AutoReadLock alock (this);
    84568456        directControl = mData->mSession.mDirectControl;
    84578457    }
     
    84768476    ComPtr <IInternalSessionControl> directControl;
    84778477    {
    8478         AutoReaderLock alock (this);
     8478        AutoReadLock alock (this);
    84798479        directControl = mData->mSession.mDirectControl;
    84808480    }
     
    84998499    ComPtr <IInternalSessionControl> directControl;
    85008500    {
    8501         AutoReaderLock alock (this);
     8501        AutoReadLock alock (this);
    85028502        directControl = mData->mSession.mDirectControl;
    85038503    }
     
    85228522    ComPtr <IInternalSessionControl> directControl;
    85238523    {
    8524         AutoReaderLock alock (this);
     8524        AutoReadLock alock (this);
    85258525        directControl = mData->mSession.mDirectControl;
    85268526    }
     
    85458545    ComPtr <IInternalSessionControl> directControl;
    85468546    {
    8547         AutoReaderLock alock (this);
     8547        AutoReadLock alock (this);
    85488548        directControl = mData->mSession.mDirectControl;
    85498549    }
     
    85688568    ComPtr <IInternalSessionControl> directControl;
    85698569    {
    8570         AutoReaderLock alock (this);
     8570        AutoReadLock alock (this);
    85718571        directControl = mData->mSession.mDirectControl;
    85728572    }
     
    85918591    ComPtr <IInternalSessionControl> directControl;
    85928592    {
    8593         AutoReaderLock alock (this);
     8593        AutoReadLock alock (this);
    85948594        directControl = mData->mSession.mDirectControl;
    85958595    }
     
    86168616        return false;
    86178617
    8618     AutoReaderLock alock (this);
     8618    AutoReadLock alock (this);
    86198619
    86208620#ifdef VBOX_WITH_USB
     
    86428642    ComPtr <IInternalSessionControl> directControl;
    86438643    {
    8644         AutoReaderLock alock (this);
     8644        AutoReadLock alock (this);
    86458645        directControl = mData->mSession.mDirectControl;
    86468646    }
     
    86708670    ComPtr <IInternalSessionControl> directControl;
    86718671    {
    8672         AutoReaderLock alock (this);
     8672        AutoReadLock alock (this);
    86738673        directControl = mData->mSession.mDirectControl;
    86748674    }
     
    89738973            ComObjPtr <HardDisk> parent = hd->parent();
    89748974
    8975             AutoLock hdLock (hd);
     8975            AutoWriteLock hdLock (hd);
    89768976
    89778977            if (hd->hasForeignChildren())
     
    89868986            if (hd->type() == HardDiskType_Normal)
    89878987            {
    8988                 AutoLock hdChildrenLock (hd->childrenLock());
     8988                AutoWriteLock hdChildrenLock (hd->childrenLock ());
    89898989                size_t childrenCount = hd->children().size();
    89908990                if (childrenCount > 1)
     
    90419041            ComObjPtr <HardDisk> parent = hd->parent();
    90429042
    9043             AutoLock hdLock (hd);
     9043            AutoWriteLock hdLock (hd);
    90449044
    90459045            Bstr hdRootString = hd->root()->toString (true /* aShort */);
     
    91059105                ComObjPtr <HardDisk> child;
    91069106                {
    9107                     AutoLock hdChildrenLock (hd->childrenLock());
     9107                    AutoWriteLock hdChildrenLock (hd->childrenLock ());
    91089108                    if (hd->children().size())
    91099109                        child = hd->children().front();
     
    91259125                else
    91269126                {
    9127                     AutoLock childLock (child);
     9127                    AutoWriteLock childLock (child);
    91289128
    91299129                    aTask.progress->advanceOperation (Bstr (Utf8StrFmt (
     
    93959395        {
    93969396            ComObjPtr <Snapshot> curSnapshot = mData->mCurrentSnapshot;
    9397             AutoLock snapshotLock (curSnapshot);
     9397            AutoWriteLock snapshotLock (curSnapshot);
    93989398
    93999399            /* remember the timestamp of the snapshot we're restoring from */
     
    95929592    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    95939593
    9594     AutoLock alock (this);
     9594    AutoWriteLock alock (this);
    95959595
    95969596    MachineState_T oldMachineState = mData->mMachineState;
     
    96219621        {
    96229622            ComObjPtr <HardDisk> hd = (*it)->hardDisk();
    9623             AutoLock hdLock (hd);
     9623            AutoWriteLock hdLock (hd);
    96249624            hd->setBusy();
    96259625            hd->addReaderOnAncestors();
     
    96419641        {
    96429642            ComObjPtr <HardDisk> hd = (*it)->hardDisk();
    9643             AutoLock hdLock (hd);
     9643            AutoWriteLock hdLock (hd);
    96449644            hd->releaseReaderOnAncestors();
    96459645            hd->clearBusy();
     
    97629762    ComPtr <IInternalSessionControl> directControl;
    97639763    {
    9764         AutoReaderLock alock (this);
     9764        AutoReadLock alock (this);
    97659765        AssertReturn (!!mData, E_FAIL);
    97669766        directControl = mData->mSession.mDirectControl;
     
    98449844    AssertReturn (autoInitSpan.isOk(), E_UNEXPECTED);
    98459845
    9846     AssertReturn (aSessionMachine->isLockedOnCurrentThread(), E_FAIL);
     9846    AssertReturn (aSessionMachine->isWriteLockOnCurrentThread(), E_FAIL);
    98479847
    98489848    mSnapshotId = aSnapshotId;
     
    1007110071}
    1007210072
    10073 // AutoLock::Lockable interface
     10073// util::Lockable interface
    1007410074////////////////////////////////////////////////////////////////////////////////
    1007510075
     
    1009510095HRESULT SnapshotMachine::onSnapshotChange (Snapshot *aSnapshot)
    1009610096{
    10097     AutoLock alock (this);
     10097    AutoWriteLock alock (this);
    1009810098
    1009910099    mPeer->saveSnapshotSettings (aSnapshot, SaveSS_UpdateAttrsOp);
  • trunk/src/VBox/Main/MouseImpl.cpp

    r5999 r8083  
    7676    ComAssertRet (parent, E_INVALIDARG);
    7777
    78     AutoLock alock (this);
     78    AutoWriteLock alock (this);
    7979    ComAssertRet (!isReady(), E_UNEXPECTED);
    8080
     
    100100    LogFlow(("Mouse::uninit(): isReady=%d\n", isReady()));
    101101
    102     AutoLock alock (this);
     102    AutoWriteLock alock (this);
    103103    AssertReturn (isReady(), (void) 0);
    104104
     
    125125        return E_POINTER;
    126126
    127     AutoLock alock (this);
     127    AutoWriteLock alock (this);
    128128    CHECK_READY();
    129129
     
    152152        return E_POINTER;
    153153
    154     AutoLock alock (this);
     154    AutoWriteLock alock (this);
    155155    CHECK_READY();
    156156
     
    181181STDMETHODIMP Mouse::PutMouseEvent(LONG dx, LONG dy, LONG dz, LONG buttonState)
    182182{
    183     AutoLock alock (this);
     183    AutoWriteLock alock (this);
    184184    CHECK_READY();
    185185
     
    234234                                          LONG buttonState)
    235235{
    236     AutoLock alock (this);
     236    AutoWriteLock alock (this);
    237237    CHECK_READY();
    238238
     
    340340    if (pData->pMouse)
    341341    {
    342         AutoLock mouseLock (pData->pMouse);
     342        AutoWriteLock mouseLock (pData->pMouse);
    343343        pData->pMouse->mpDrv = NULL;
    344344    }
  • trunk/src/VBox/Main/NetworkAdapterImpl.cpp

    r7992 r8083  
    107107    AssertComRCReturnRC (thatCaller.rc());
    108108
    109     AutoReaderLock thatLock (aThat);
     109    AutoReadLock thatLock (aThat);
    110110    mData.share (aThat->mData);
    111111
     
    139139    AssertComRCReturnRC (thatCaller.rc());
    140140
    141     AutoReaderLock thatLock (aThat);
     141    AutoReadLock thatLock (aThat);
    142142    mData.attachCopy (aThat->mData);
    143143
     
    178178    CheckComRCReturnRC (autoCaller.rc());
    179179
    180     AutoReaderLock alock (this);
     180    AutoReadLock alock (this);
    181181
    182182    *aAdapterType = mData->mAdapterType;
     
    194194    CheckComRCReturnRC (adep.rc());
    195195
    196     AutoLock alock (this);
     196    AutoWriteLock alock (this);
    197197
    198198    /* make sure the value is allowed */
     
    233233    CheckComRCReturnRC (autoCaller.rc());
    234234
    235     AutoReaderLock alock (this);
     235    AutoReadLock alock (this);
    236236
    237237    *aSlot = mData->mSlot;
     
    248248    CheckComRCReturnRC (autoCaller.rc());
    249249
    250     AutoReaderLock alock (this);
     250    AutoReadLock alock (this);
    251251
    252252    *aEnabled = mData->mEnabled;
     
    264264    CheckComRCReturnRC (adep.rc());
    265265
    266     AutoLock alock (this);
     266    AutoWriteLock alock (this);
    267267
    268268    if (mData->mEnabled != aEnabled)
     
    288288    CheckComRCReturnRC (autoCaller.rc());
    289289
    290     AutoReaderLock alock (this);
     290    AutoReadLock alock (this);
    291291
    292292    ComAssertRet (!!mData->mMACAddress, E_FAIL);
     
    306306    CheckComRCReturnRC (adep.rc());
    307307
    308     AutoLock alock (this);
     308    AutoWriteLock alock (this);
    309309
    310310    HRESULT rc = S_OK;
     
    386386    CheckComRCReturnRC (autoCaller.rc());
    387387
    388     AutoReaderLock alock (this);
     388    AutoReadLock alock (this);
    389389
    390390    *aAttachmentType = mData->mAttachmentType;
     
    401401    CheckComRCReturnRC (autoCaller.rc());
    402402
    403     AutoReaderLock alock (this);
     403    AutoReadLock alock (this);
    404404
    405405    mData->mHostInterface.cloneTo (aHostInterface);
     
    432432    CheckComRCReturnRC (adep.rc());
    433433
    434     AutoLock alock (this);
     434    AutoWriteLock alock (this);
    435435
    436436    if (mData->mHostInterface != aHostInterface)
     
    458458    CheckComRCReturnRC (autoCaller.rc());
    459459
    460     AutoReaderLock alock (this);
     460    AutoReadLock alock (this);
    461461
    462462    *aTAPFileDescriptor = mData->mTAPFD;
     
    485485    CheckComRCReturnRC (adep.rc());
    486486
    487     AutoLock alock (this);
     487    AutoWriteLock alock (this);
    488488
    489489    if (mData->mTAPFD != (RTFILE) aTAPFileDescriptor)
     
    510510    CheckComRCReturnRC (autoCaller.rc());
    511511
    512     AutoReaderLock alock (this);
     512    AutoReadLock alock (this);
    513513
    514514    /* we don't have to be in TAP mode to support this call */
     
    532532    CheckComRCReturnRC (adep.rc());
    533533
    534     AutoLock alock (this);
     534    AutoWriteLock alock (this);
    535535
    536536    if (mData->mTAPSetupApplication != aTAPSetupApplication)
     
    557557    CheckComRCReturnRC (autoCaller.rc());
    558558
    559     AutoReaderLock alock (this);
     559    AutoReadLock alock (this);
    560560
    561561    /* we don't have to be in TAP mode to support this call */
     
    579579    CheckComRCReturnRC (adep.rc());
    580580
    581     AutoLock alock (this);
     581    AutoWriteLock alock (this);
    582582
    583583    if (mData->mTAPTerminateApplication != aTAPTerminateApplication)
     
    606606    CheckComRCReturnRC (autoCaller.rc());
    607607
    608     AutoReaderLock alock (this);
     608    AutoReadLock alock (this);
    609609
    610610    mData->mInternalNetwork.cloneTo (aInternalNetwork);
     
    625625    CheckComRCReturnRC (adep.rc());
    626626
    627     AutoLock alock (this);
     627    AutoWriteLock alock (this);
    628628
    629629    if (mData->mInternalNetwork != aInternalNetwork)
     
    656656    CheckComRCReturnRC (autoCaller.rc());
    657657
    658     AutoReaderLock alock (this);
     658    AutoReadLock alock (this);
    659659
    660660    *aConnected = mData->mCableConnected;
     
    672672    CheckComRCReturnRC (adep.rc());
    673673
    674     AutoLock alock (this);
     674    AutoWriteLock alock (this);
    675675
    676676    if (aConnected != mData->mCableConnected)
     
    696696    CheckComRCReturnRC (autoCaller.rc());
    697697
    698     AutoReaderLock alock (this);
     698    AutoReadLock alock (this);
    699699
    700700    *aSpeed = mData->mLineSpeed;
     
    712712    CheckComRCReturnRC (adep.rc());
    713713
    714     AutoLock alock (this);
     714    AutoWriteLock alock (this);
    715715
    716716    if (aSpeed != mData->mLineSpeed)
     
    736736    CheckComRCReturnRC (autoCaller.rc());
    737737
    738     AutoReaderLock alock (this);
     738    AutoReadLock alock (this);
    739739
    740740    *aEnabled = mData->mTraceEnabled;
     
    751751    CheckComRCReturnRC (adep.rc());
    752752
    753     AutoLock alock (this);
     753    AutoWriteLock alock (this);
    754754
    755755    if (aEnabled != mData->mTraceEnabled)
     
    775775    CheckComRCReturnRC (autoCaller.rc());
    776776
    777     AutoReaderLock alock (this);
     777    AutoReadLock alock (this);
    778778
    779779    mData->mTraceFile.cloneTo (aTraceFile);
     
    791791    CheckComRCReturnRC (adep.rc());
    792792
    793     AutoLock alock (this);
     793    AutoWriteLock alock (this);
    794794
    795795    if (mData->mTraceFile != aTraceFile)
     
    819819    CheckComRCReturnRC (adep.rc());
    820820
    821     AutoLock alock (this);
     821    AutoWriteLock alock (this);
    822822
    823823    if (mData->mAttachmentType != NetworkAttachmentType_NAT)
     
    847847    CheckComRCReturnRC (adep.rc());
    848848
    849     AutoLock alock (this);
     849    AutoWriteLock alock (this);
    850850
    851851    /* don't do anything if we're already host interface attached */
     
    877877    CheckComRCReturnRC (adep.rc());
    878878
    879     AutoLock alock (this);
     879    AutoWriteLock alock (this);
    880880
    881881    /* don't do anything if we're already internal network attached */
     
    916916    CheckComRCReturnRC (adep.rc());
    917917
    918     AutoLock alock (this);
     918    AutoWriteLock alock (this);
    919919
    920920    if (mData->mAttachmentType != NetworkAttachmentType_Null)
     
    953953    AssertComRCReturnRC (autoCaller.rc());
    954954
    955     AutoLock alock (this);
     955    AutoWriteLock alock (this);
    956956
    957957    /* Note: we assume that the default values for attributes of optional
     
    10651065    AssertComRCReturnRC (autoCaller.rc());
    10661066
    1067     AutoReaderLock alock (this);
     1067    AutoReadLock alock (this);
    10681068
    10691069    aAdapterNode.setValue <bool> ("enabled", !!mData->mEnabled);
     
    11541154    AssertComRCReturn (autoCaller.rc(), false);
    11551155
    1156     AutoLock alock (this);
     1156    AutoWriteLock alock (this);
    11571157
    11581158    bool changed = false;
     
    12321232void NetworkAdapter::detach()
    12331233{
    1234     AssertReturnVoid (isLockedOnCurrentThread());
     1234    AssertReturnVoid (isWriteLockOnCurrentThread());
    12351235
    12361236    switch (mData->mAttachmentType)
  • trunk/src/VBox/Main/ParallelPortImpl.cpp

    r7992 r8083  
    9797    AssertComRCReturnRC (thatCaller.rc());
    9898
    99     AutoReaderLock thatLock (aThat);
     99    AutoReadLock thatLock (aThat);
    100100    mData.share (aThat->mData);
    101101
     
    129129    AssertComRCReturnRC (thatCaller.rc());
    130130
    131     AutoReaderLock thatLock (aThat);
     131    AutoReadLock thatLock (aThat);
    132132    mData.attachCopy (aThat->mData);
    133133
     
    177177    AssertComRCReturnRC (autoCaller.rc());
    178178
    179     AutoLock alock (this);
     179    AutoWriteLock alock (this);
    180180
    181181    /* Note: we assume that the default values for attributes of optional
     
    224224    AssertComRCReturnRC (autoCaller.rc());
    225225
    226     AutoReaderLock alock (this);
     226    AutoReadLock alock (this);
    227227
    228228    aPortNode.setValue <bool> ("enabled", !!mData->mEnabled);
     
    246246    AssertComRCReturn (autoCaller.rc(), false);
    247247
    248     AutoLock alock (this);
     248    AutoWriteLock alock (this);
    249249
    250250    bool changed = false;
     
    325325    CheckComRCReturnRC (autoCaller.rc());
    326326
    327     AutoReaderLock alock (this);
     327    AutoReadLock alock (this);
    328328
    329329    *aEnabled = mData->mEnabled;
     
    343343    CheckComRCReturnRC (adep.rc());
    344344
    345     AutoLock alock (this);
     345    AutoWriteLock alock (this);
    346346
    347347    if (mData->mEnabled != aEnabled)
     
    374374    CheckComRCReturnRC (autoCaller.rc());
    375375
    376     AutoReaderLock alock (this);
     376    AutoReadLock alock (this);
    377377
    378378    *aSlot = mData->mSlot;
     
    389389    CheckComRCReturnRC (autoCaller.rc());
    390390
    391     AutoReaderLock alock (this);
     391    AutoReadLock alock (this);
    392392
    393393    *aIRQ = mData->mIRQ;
     
    413413    CheckComRCReturnRC (adep.rc());
    414414
    415     AutoLock alock (this);
     415    AutoWriteLock alock (this);
    416416
    417417    HRESULT rc = S_OK;
     
    444444    CheckComRCReturnRC (autoCaller.rc());
    445445
    446     AutoReaderLock alock (this);
     446    AutoReadLock alock (this);
    447447
    448448    *aIOBase = mData->mIOBase;
     
    468468    CheckComRCReturnRC (adep.rc());
    469469
    470     AutoLock alock (this);
     470    AutoWriteLock alock (this);
    471471
    472472    HRESULT rc = S_OK;
     
    499499    CheckComRCReturnRC (autoCaller.rc());
    500500
    501     AutoReaderLock alock (this);
     501    AutoReadLock alock (this);
    502502
    503503    mData->mPath.cloneTo (aPath);
     
    511511HRESULT ParallelPort::checkSetPath (const BSTR aPath)
    512512{
    513     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     513    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    514514
    515515    if (mData->mEnabled &&
     
    532532    CheckComRCReturnRC (adep.rc());
    533533
    534     AutoLock alock (this);
     534    AutoWriteLock alock (this);
    535535
    536536    if (mData->mPath != aPath)
  • trunk/src/VBox/Main/ProgressImpl.cpp

    r7992 r8083  
    158158 *  Using mParent member after this method returns is forbidden.
    159159 */
    160 void ProgressBase::protectedUninit (AutoLock &alock)
     160void ProgressBase::protectedUninit (AutoWriteLock &alock)
    161161{
    162162    LogFlowMember (("ProgressBase::protectedUninit()\n"));
    163163
    164     Assert (alock.belongsTo (this) && alock.isLockedOnCurrentThread() &&
     164    Assert (alock.belongsTo (this) && alock.isWriteLockOnCurrentThread() &&
    165165            alock.writeLockLevel() == 1);
    166166    Assert (isReady());
     
    194194        return E_POINTER;
    195195
    196     AutoLock lock (this);
     196    AutoWriteLock alock (this);
    197197    CHECK_READY();
    198198
     
    208208        return E_POINTER;
    209209
    210     AutoLock lock (this);
     210    AutoWriteLock alock (this);
    211211    CHECK_READY();
    212212
     
    222222        return E_POINTER;
    223223
    224     AutoLock lock(this);
     224    AutoWriteLock alock (this);
    225225    CHECK_READY();
    226226
     
    246246        return E_POINTER;
    247247
    248     AutoLock lock(this);
     248    AutoWriteLock alock (this);
    249249    CHECK_READY();
    250250
     
    258258        return E_POINTER;
    259259
    260     AutoLock lock(this);
     260    AutoWriteLock alock (this);
    261261    CHECK_READY();
    262262
     
    278278        return E_POINTER;
    279279
    280     AutoLock lock(this);
     280    AutoWriteLock alock (this);
    281281    CHECK_READY();
    282282
     
    290290        return E_POINTER;
    291291
    292     AutoLock lock(this);
     292    AutoWriteLock alock (this);
    293293    CHECK_READY();
    294294
     
    302302        return E_POINTER;
    303303
    304     AutoLock lock(this);
     304    AutoWriteLock alock (this);
    305305    CHECK_READY();
    306306
     
    318318        return E_POINTER;
    319319
    320     AutoLock lock(this);
     320    AutoWriteLock alock (this);
    321321    CHECK_READY();
    322322
     
    334334        return E_POINTER;
    335335
    336     AutoLock lock(this);
     336    AutoWriteLock alock (this);
    337337    CHECK_READY();
    338338
     
    346346        return E_POINTER;
    347347
    348     AutoLock lock(this);
     348    AutoWriteLock alock (this);
    349349    CHECK_READY();
    350350
     
    358358        return E_POINTER;
    359359
    360     AutoLock lock(this);
     360    AutoWriteLock alock (this);
    361361    CHECK_READY();
    362362
     
    370370        return E_POINTER;
    371371
    372     AutoLock lock(this);
     372    AutoWriteLock alock (this);
    373373    CHECK_READY();
    374374
     
    429429    ComAssertRet (aOperationCount >= 1, E_INVALIDARG);
    430430
    431     AutoLock lock(this);
     431    AutoWriteLock alock (this);
    432432    ComAssertRet (!isReady(), E_UNEXPECTED);
    433433
     
    470470    LogFlowMember(("Progress::init(): <undescriptioned>\n"));
    471471
    472     AutoLock lock(this);
     472    AutoWriteLock alock (this);
    473473    ComAssertRet (!isReady(), E_UNEXPECTED);
    474474
     
    510510    LogFlowMember (("Progress::uninit()\n"));
    511511
    512     AutoLock alock (this);
     512    AutoWriteLock alock (this);
    513513
    514514    LogFlowMember (("Progress::uninit(): isReady=%d\n", isReady()));
     
    547547    LogFlowMember(("Progress::WaitForCompletion: BEGIN: timeout=%d\n", aTimeout));
    548548
    549     AutoLock lock(this);
     549    AutoWriteLock alock (this);
    550550    CHECK_READY();
    551551
     
    564564        {
    565565            mWaitersCount ++;
    566             lock.unlock();
     566            alock.unlock();
    567567            int vrc = RTSemEventMultiWait (mCompletedSem,
    568568                                           forever ? RT_INDEFINITE_WAIT
    569569                                                   : (unsigned) timeLeft);
    570             lock.lock();
     570            alock.lock();
    571571            mWaitersCount --;
    572572
     
    611611                   "operation=%d, timeout=%d\n", aOperation, aTimeout));
    612612
    613     AutoLock lock(this);
     613    AutoWriteLock alock (this);
    614614    CHECK_READY();
    615615
     
    634634        {
    635635            mWaitersCount ++;
    636             lock.unlock();
     636            alock.unlock();
    637637            int vrc = RTSemEventMultiWait (mCompletedSem,
    638638                                           forever ? RT_INDEFINITE_WAIT
    639639                                                   : (unsigned) timeLeft);
    640             lock.lock();
     640            alock.lock();
    641641            mWaitersCount --;
    642642
     
    671671STDMETHODIMP Progress::Cancel()
    672672{
    673     AutoLock lock(this);
     673    AutoWriteLock alock (this);
    674674    CHECK_READY();
    675675
     
    697697HRESULT Progress::notifyProgress (LONG aPercent)
    698698{
    699     AutoLock lock (this);
     699    AutoWriteLock alock (this);
    700700    AssertReturn (isReady(), E_UNEXPECTED);
    701701
     
    721721    AssertReturn (aOperationDescription, E_INVALIDARG);
    722722
    723     AutoLock lock (this);
     723    AutoWriteLock alock (this);
    724724    AssertReturn (isReady(), E_UNEXPECTED);
    725725
     
    756756HRESULT Progress::notifyComplete (HRESULT aResultCode)
    757757{
    758     AutoLock lock (this);
     758    AutoWriteLock alock (this);
    759759    AssertReturn (isReady(), E_FAIL);
    760760
     
    865865                                      const Bstr &aComponent, const Bstr &aText)
    866866{
    867     AutoLock lock (this);
     867    AutoWriteLock alock (this);
    868868    AssertReturn (isReady(), E_UNEXPECTED);
    869869
     
    10061006    LogFlowMember (("CombinedProgress::uninit()\n"));
    10071007
    1008     AutoLock alock (this);
     1008    AutoWriteLock alock (this);
    10091009
    10101010    LogFlowMember (("CombinedProgress::uninit(): isReady=%d\n", isReady()));
     
    10271027        return E_POINTER;
    10281028
    1029     AutoLock lock(this);
     1029    AutoWriteLock alock (this);
    10301030    CHECK_READY();
    10311031
     
    10511051        return E_POINTER;
    10521052
    1053     AutoLock lock(this);
     1053    AutoWriteLock alock (this);
    10541054    CHECK_READY();
    10551055
     
    10661066        return E_POINTER;
    10671067
    1068     AutoLock lock(this);
     1068    AutoWriteLock alock (this);
    10691069    CHECK_READY();
    10701070
     
    10811081        return E_POINTER;
    10821082
    1083     AutoLock lock(this);
     1083    AutoWriteLock alock (this);
    10841084    CHECK_READY();
    10851085
     
    10961096        return E_POINTER;
    10971097
    1098     AutoLock lock(this);
     1098    AutoWriteLock alock (this);
    10991099    CHECK_READY();
    11001100
     
    11111111        return E_POINTER;
    11121112
    1113     AutoLock lock(this);
     1113    AutoWriteLock alock (this);
    11141114    CHECK_READY();
    11151115
     
    11261126        return E_POINTER;
    11271127
    1128     AutoLock lock(this);
     1128    AutoWriteLock alock (this);
    11291129    CHECK_READY();
    11301130
     
    11411141        return E_POINTER;
    11421142
    1143     AutoLock lock(this);
     1143    AutoWriteLock alock (this);
    11441144    CHECK_READY();
    11451145
     
    11661166                    aTimeout));
    11671167
    1168     AutoLock lock (this);
     1168    AutoWriteLock alock (this);
    11691169    CHECK_READY();
    11701170
     
    11821182        while (!mCompleted && (forever || timeLeft > 0))
    11831183        {
    1184             lock.unlock();
     1184            alock.unlock();
    11851185            rc = mProgresses.back()->WaitForCompletion (
    11861186                forever ? -1 : (LONG) timeLeft);
    1187             lock.lock();
     1187            alock.lock();
    11881188
    11891189            // the progress might have been uninitialized
     
    12251225                   "operation=%d, timeout=%d\n", aOperation, aTimeout));
    12261226
    1227     AutoLock lock(this);
     1227    AutoWriteLock alock (this);
    12281228    CHECK_READY();
    12291229
     
    12751275               (forever || timeLeft > 0))
    12761276        {
    1277             lock.unlock();
     1277            alock.unlock();
    12781278            // wait for the appropriate progress operation completion
    12791279            rc = mProgresses [progress]-> WaitForOperationCompletion (
    12801280                operation, forever ? -1 : (LONG) timeLeft);
    1281             lock.lock();
     1281            alock.lock();
    12821282
    12831283            // the progress might have been uninitialized
     
    13091309STDMETHODIMP CombinedProgress::Cancel()
    13101310{
    1311     AutoLock lock(this);
     1311    AutoWriteLock alock (this);
    13121312    CHECK_READY();
    13131313
  • trunk/src/VBox/Main/RemoteUSBDeviceImpl.cpp

    r7207 r8083  
    5252    LogFlowMember (("RemoteUSBDevice::init()\n"));
    5353
    54     AutoLock alock (this);
     54    AutoWriteLock alock (this);
    5555    ComAssertRet (!isReady(), E_UNEXPECTED);
    5656
     
    9393    LogFlowMember (("RemoteUSBDevice::uninit()\n"));
    9494
    95     AutoLock alock (this);
     95    AutoWriteLock alock (this);
    9696    AssertReturn (isReady(), (void) 0);
    9797
     
    107107        return E_INVALIDARG;
    108108
    109     AutoLock alock (this);
     109    AutoWriteLock alock (this);
    110110    CHECK_READY();
    111111
     
    119119        return E_INVALIDARG;
    120120
    121     AutoLock alock (this);
     121    AutoWriteLock alock (this);
    122122    CHECK_READY();
    123123
     
    131131        return E_INVALIDARG;
    132132
    133     AutoLock alock (this);
     133    AutoWriteLock alock (this);
    134134    CHECK_READY();
    135135
     
    143143        return E_INVALIDARG;
    144144
    145     AutoLock alock (this);
     145    AutoWriteLock alock (this);
    146146    CHECK_READY();
    147147
     
    155155        return E_INVALIDARG;
    156156
    157     AutoLock alock (this);
     157    AutoWriteLock alock (this);
    158158    CHECK_READY();
    159159
     
    167167        return E_INVALIDARG;
    168168
    169     AutoLock alock (this);
     169    AutoWriteLock alock (this);
    170170    CHECK_READY();
    171171
     
    179179        return E_INVALIDARG;
    180180
    181     AutoLock alock (this);
     181    AutoWriteLock alock (this);
    182182    CHECK_READY();
    183183
     
    191191        return E_INVALIDARG;
    192192
    193     AutoLock alock (this);
     193    AutoWriteLock alock (this);
    194194    CHECK_READY();
    195195
     
    203203        return E_INVALIDARG;
    204204
    205     AutoLock alock (this);
     205    AutoWriteLock alock (this);
    206206    CHECK_READY();
    207207
     
    215215        return E_INVALIDARG;
    216216
    217     AutoLock alock (this);
     217    AutoWriteLock alock (this);
    218218    CHECK_READY();
    219219
     
    227227        return E_INVALIDARG;
    228228
    229     AutoLock alock (this);
     229    AutoWriteLock alock (this);
    230230    CHECK_READY();
    231231
     
    239239        return E_INVALIDARG;
    240240
    241     AutoLock alock (this);
     241    AutoWriteLock alock (this);
    242242    CHECK_READY();
    243243
     
    255255        return E_POINTER;
    256256
    257     AutoLock lock (this);
     257    AutoWriteLock alock (this);
    258258    CHECK_READY();
    259259
  • trunk/src/VBox/Main/SATAControllerImpl.cpp

    r7992 r8083  
    105105    unconst (mPeer) = aPeer;
    106106
    107     AutoLock thatlock (aPeer);
     107    AutoWriteLock thatlock (aPeer);
    108108    mData.share (aPeer->mData);
    109109
     
    133133    /* mPeer is left null */
    134134
    135     AutoLock thatlock (aPeer);
     135    AutoWriteLock thatlock (aPeer);
    136136    mData.attachCopy (aPeer->mData);
    137137
     
    177177    CheckComRCReturnRC (autoCaller.rc());
    178178
    179     AutoReaderLock alock (this);
     179    AutoReadLock alock (this);
    180180
    181181    *aEnabled = mData->mEnabled;
     
    196196    CheckComRCReturnRC (adep.rc());
    197197
    198     AutoLock alock (this);
     198    AutoWriteLock alock (this);
    199199
    200200    if (mData->mEnabled != aEnabled)
     
    220220    CheckComRCReturnRC (autoCaller.rc());
    221221
    222     AutoReaderLock alock (this);
     222    AutoReadLock alock (this);
    223223
    224224    *aPortCount = mData->mPortCount;
     
    239239    CheckComRCReturnRC (adep.rc());
    240240
    241     AutoLock alock (this);
     241    AutoWriteLock alock (this);
    242242
    243243    if (mData->mPortCount != aPortCount)
     
    295295    Machine::AutoMutableStateDependency adep (mParent);
    296296    CheckComRCReturnRC (adep.rc());
    297     AutoLock alock (this);
     297    AutoWriteLock alock (this);
    298298
    299299    switch (DevicePosition)
     
    338338    AssertComRCReturnRC (autoCaller.rc());
    339339
    340     AutoLock alock (this);
     340    AutoWriteLock alock (this);
    341341
    342342    /* SATA Controller node (required) */
     
    374374    CheckComRCReturnRC (autoCaller.rc());
    375375
    376     AutoReaderLock alock (this);
     376    AutoReadLock alock (this);
    377377
    378378    /* first, delete the entry */
     
    404404    AssertComRCReturn (autoCaller.rc(), false);
    405405
    406     AutoReaderLock alock (this);
     406    AutoReadLock alock (this);
    407407
    408408    if (mData.isBackedUp())
     
    418418    AssertComRCReturn (autoCaller.rc(), false);
    419419
    420     AutoReaderLock alock (this);
     420    AutoReadLock alock (this);
    421421
    422422    if (mData.hasActualChanges())
     
    436436    AssertComRCReturn (adep.rc(), false);
    437437
    438     AutoLock alock (this);
     438    AutoWriteLock alock (this);
    439439
    440440    bool dataChanged = false;
     
    475475        {
    476476            // attach new data to the peer and reshare it
    477             AutoLock peerlock (mPeer);
     477            AutoWriteLock peerlock (mPeer);
    478478            mPeer->mData.attach (mData);
    479479        }
  • trunk/src/VBox/Main/SerialPortImpl.cpp

    r7992 r8083  
    9797    AssertComRCReturnRC (thatCaller.rc());
    9898
    99     AutoReaderLock thatLock (aThat);
     99    AutoReadLock thatLock (aThat);
    100100    mData.share (aThat->mData);
    101101
     
    129129    AssertComRCReturnRC (thatCaller.rc());
    130130
    131     AutoReaderLock thatLock (aThat);
     131    AutoReadLock thatLock (aThat);
    132132    mData.attachCopy (aThat->mData);
    133133
     
    177177    AssertComRCReturnRC (autoCaller.rc());
    178178
    179     AutoLock alock (this);
     179    AutoWriteLock alock (this);
    180180
    181181    /* Note: we assume that the default values for attributes of optional
     
    237237    AssertComRCReturnRC (autoCaller.rc());
    238238
    239     AutoReaderLock alock (this);
     239    AutoReadLock alock (this);
    240240
    241241    aPortNode.setValue <bool> ("enabled", !!mData->mEnabled);
     
    282282    AssertComRCReturn (autoCaller.rc(), false);
    283283
    284     AutoLock alock (this);
     284    AutoWriteLock alock (this);
    285285
    286286    bool changed = false;
     
    361361    CheckComRCReturnRC (autoCaller.rc());
    362362
    363     AutoReaderLock alock (this);
     363    AutoReadLock alock (this);
    364364
    365365    *aEnabled = mData->mEnabled;
     
    379379    CheckComRCReturnRC (adep.rc());
    380380
    381     AutoLock alock (this);
     381    AutoWriteLock alock (this);
    382382
    383383    if (mData->mEnabled != aEnabled)
     
    403403    CheckComRCReturnRC (autoCaller.rc());
    404404
    405     AutoReaderLock alock (this);
     405    AutoReadLock alock (this);
    406406
    407407    *aHostMode = mData->mHostMode;
     
    419419    CheckComRCReturnRC (adep.rc());
    420420
    421     AutoLock alock (this);
     421    AutoWriteLock alock (this);
    422422
    423423    HRESULT rc = S_OK;
     
    471471    CheckComRCReturnRC (autoCaller.rc());
    472472
    473     AutoReaderLock alock (this);
     473    AutoReadLock alock (this);
    474474
    475475    *aSlot = mData->mSlot;
     
    486486    CheckComRCReturnRC (autoCaller.rc());
    487487
    488     AutoReaderLock alock (this);
     488    AutoReadLock alock (this);
    489489
    490490    *aIRQ = mData->mIRQ;
     
    510510    CheckComRCReturnRC (adep.rc());
    511511
    512     AutoLock alock (this);
     512    AutoWriteLock alock (this);
    513513
    514514    HRESULT rc = S_OK;
     
    541541    CheckComRCReturnRC (autoCaller.rc());
    542542
    543     AutoReaderLock alock (this);
     543    AutoReadLock alock (this);
    544544
    545545    *aIOBase = mData->mIOBase;
     
    565565    CheckComRCReturnRC (adep.rc());
    566566
    567     AutoLock alock (this);
     567    AutoWriteLock alock (this);
    568568
    569569    HRESULT rc = S_OK;
     
    596596    CheckComRCReturnRC (autoCaller.rc());
    597597
    598     AutoReaderLock alock (this);
     598    AutoReadLock alock (this);
    599599
    600600    mData->mPath.cloneTo (aPath);
     
    608608HRESULT SerialPort::checkSetPath (const BSTR aPath)
    609609{
    610     AssertReturn (isLockedOnCurrentThread(), E_FAIL);
     610    AssertReturn (isWriteLockOnCurrentThread(), E_FAIL);
    611611
    612612    if ((mData->mHostMode == PortMode_HostDevice ||
     
    630630    CheckComRCReturnRC (adep.rc());
    631631
    632     AutoLock alock (this);
     632    AutoWriteLock alock (this);
    633633
    634634    if (mData->mPath != aPath)
     
    657657    CheckComRCReturnRC (autoCaller.rc());
    658658
    659     AutoReaderLock alock (this);
     659    AutoReadLock alock (this);
    660660
    661661    *aServer = mData->mServer;
     
    675675    CheckComRCReturnRC (adep.rc());
    676676
    677     AutoLock alock (this);
     677    AutoWriteLock alock (this);
    678678
    679679    if (mData->mServer != aServer)
  • trunk/src/VBox/Main/SessionImpl.cpp

    r8057 r8083  
    127127
    128128    /* close() needs write lock */
    129     AutoLock alock (this);
     129    AutoWriteLock alock (this);
    130130
    131131    if (mState != SessionState_Closed)
     
    152152    CheckComRCReturnRC (autoCaller.rc());
    153153
    154     AutoReaderLock alock (this);
     154    AutoReadLock alock (this);
    155155
    156156    *aState = mState;
     
    167167    CheckComRCReturnRC (autoCaller.rc());
    168168
    169     AutoReaderLock alock (this);
     169    AutoReadLock alock (this);
    170170
    171171    CHECK_OPEN();
     
    183183    CheckComRCReturnRC (autoCaller.rc());
    184184
    185     AutoReaderLock alock (this);
     185    AutoReadLock alock (this);
    186186
    187187    CHECK_OPEN();
     
    206206    CheckComRCReturnRC (autoCaller.rc());
    207207
    208     AutoReaderLock alock (this);
     208    AutoReadLock alock (this);
    209209
    210210    CHECK_OPEN();
     
    232232
    233233    /* close() needs write lock */
    234     AutoLock alock (this);
     234    AutoWriteLock alock (this);
    235235
    236236    CHECK_OPEN();
     
    249249    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    250250
    251     AutoReaderLock alock (this);
     251    AutoReadLock alock (this);
    252252
    253253    *aPid = (ULONG) RTProcSelf();
     
    264264    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    265265
    266     AutoReaderLock alock (this);
     266    AutoReadLock alock (this);
    267267
    268268    AssertReturn (mState == SessionState_Open, E_FAIL);
     
    284284    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    285285
    286     AutoLock alock (this);
     286    AutoWriteLock alock (this);
    287287
    288288    AssertReturn (mState == SessionState_Closed, E_FAIL);
     
    355355    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    356356
    357     AutoLock alock (this);
     357    AutoWriteLock alock (this);
    358358
    359359    AssertReturn (mState == SessionState_Closed ||
     
    432432    }
    433433
    434     AutoReaderLock alock (this);
     434    AutoReadLock alock (this);
    435435
    436436    if (mState == SessionState_Closing)
     
    460460    {
    461461        /* close() needs write lock */
    462         AutoLock alock (this);
     462        AutoWriteLock alock (this);
    463463
    464464        LogFlowThisFunc (("mState=%d, mType=%d\n", mState, mType));
     
    502502    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    503503
    504     AutoReaderLock alock (this);
     504    AutoReadLock alock (this);
    505505    AssertReturn (mState == SessionState_Open &&
    506506                  mType == SessionType_Direct, E_FAIL);
     
    516516    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    517517
    518     AutoReaderLock alock (this);
     518    AutoReadLock alock (this);
    519519    AssertReturn (mState == SessionState_Open &&
    520520                  mType == SessionType_Direct, E_FAIL);
     
    530530    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    531531
    532     AutoReaderLock alock (this);
     532    AutoReadLock alock (this);
    533533    AssertReturn (mState == SessionState_Open &&
    534534                  mType == SessionType_Direct, E_FAIL);
     
    544544    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    545545
    546     AutoReaderLock alock (this);
     546    AutoReadLock alock (this);
    547547    AssertReturn (mState == SessionState_Open &&
    548548                  mType == SessionType_Direct, E_FAIL);
     
    558558    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    559559
    560     AutoReaderLock alock (this);
     560    AutoReadLock alock (this);
    561561    AssertReturn (mState == SessionState_Open &&
    562562                  mType == SessionType_Direct, E_FAIL);
     
    572572    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    573573
    574     AutoReaderLock alock (this);
     574    AutoReadLock alock (this);
    575575    AssertReturn (mState == SessionState_Open &&
    576576                  mType == SessionType_Direct, E_FAIL);
     
    586586    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    587587
    588     AutoReaderLock alock (this);
     588    AutoReadLock alock (this);
    589589    AssertReturn (mState == SessionState_Open &&
    590590                  mType == SessionType_Direct, E_FAIL);
     
    600600    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    601601
    602     AutoReaderLock alock (this);
     602    AutoReadLock alock (this);
    603603    AssertReturn (mState == SessionState_Open &&
    604604                  mType == SessionType_Direct, E_FAIL);
     
    616616    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    617617
    618     AutoReaderLock alock (this);
     618    AutoReadLock alock (this);
    619619    AssertReturn (mState == SessionState_Open &&
    620620                  mType == SessionType_Direct, E_FAIL);
     
    631631    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    632632
    633     AutoReaderLock alock (this);
     633    AutoReadLock alock (this);
    634634    AssertReturn (mState == SessionState_Open &&
    635635                  mType == SessionType_Direct, E_FAIL);
     
    643643    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    644644
    645     AutoReaderLock alock (this);
     645    AutoReadLock alock (this);
    646646    AssertReturn (mState == SessionState_Open &&
    647647                  mType == SessionType_Direct, E_FAIL);
     
    671671    AssertComRCReturnRC (autoCaller.rc());
    672672
    673     AutoLock alock (this);
     673    AutoWriteLock alock (this);
    674674
    675675    LogFlowThisFunc (("mState=%d, mType=%d\n", mState, mType));
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r6076 r8083  
    6969    ComAssertRet (!aId.isEmpty() && aName && aMachine, E_INVALIDARG);
    7070
    71     AutoLock alock (this);
     71    AutoWriteLock alock (this);
    7272    ComAssertRet (!isReady(), E_UNEXPECTED);
    7373
     
    9797    LogFlowMember (("Snapshot::uninit()\n"));
    9898
    99     AutoLock alock (this);
     99    AutoWriteLock alock (this);
    100100
    101101    LogFlowMember (("Snapshot::uninit(): isReady=%d\n", isReady()));
     
    132132    LogFlowMember (("Snapshot::discard()\n"));
    133133
    134     AutoLock alock (this);
     134    AutoWriteLock alock (this);
    135135    AssertReturn (isReady(), (void) 0);
    136136
    137137    {
    138         AutoLock chLock (childrenLock());
     138        AutoWriteLock chLock (childrenLock ());
    139139        AssertReturn (!!mParent || children().size() <= 1, (void) 0);
    140140
     
    143143        {
    144144            ComObjPtr <Snapshot> child = *it;
    145             AutoLock childLock (child);
     145            AutoWriteLock childLock (child);
    146146            // reparent the child
    147147            child->mParent = mParent;
     
    166166        return E_POINTER;
    167167
    168     AutoLock alock (this);
     168    AutoWriteLock alock (this);
    169169    CHECK_READY();
    170170
     
    178178        return E_POINTER;
    179179
    180     AutoLock alock (this);
     180    AutoWriteLock alock (this);
    181181    CHECK_READY();
    182182
     
    194194        return E_INVALIDARG;
    195195
    196     AutoLock alock (this);
     196    AutoWriteLock alock (this);
    197197    CHECK_READY();
    198198
     
    214214        return E_POINTER;
    215215
    216     AutoLock alock (this);
     216    AutoWriteLock alock (this);
    217217    CHECK_READY();
    218218
     
    226226        return E_INVALIDARG;
    227227
    228     AutoLock alock (this);
     228    AutoWriteLock alock (this);
    229229    CHECK_READY();
    230230
     
    246246        return E_POINTER;
    247247
    248     AutoLock alock (this);
     248    AutoWriteLock alock (this);
    249249    CHECK_READY();
    250250
     
    258258        return E_POINTER;
    259259
    260     AutoLock alock (this);
     260    AutoWriteLock alock (this);
    261261    CHECK_READY();
    262262
     
    270270        return E_POINTER;
    271271
    272     AutoLock alock (this);
     272    AutoWriteLock alock (this);
    273273    CHECK_READY();
    274274
     
    282282        return E_POINTER;
    283283
    284     AutoLock alock (this);
     284    AutoWriteLock alock (this);
    285285    CHECK_READY();
    286286
     
    294294        return E_POINTER;
    295295
    296     AutoLock alock (this);
    297     CHECK_READY();
    298 
    299     AutoLock chLock (childrenLock());
     296    AutoWriteLock alock (this);
     297    CHECK_READY();
     298
     299    AutoWriteLock chLock (childrenLock ());
    300300
    301301    ComObjPtr <SnapshotCollection> collection;
     
    325325ULONG Snapshot::descendantCount()
    326326{
    327     AutoLock alock(this);
     327    AutoWriteLock alock(this);
    328328    AssertReturn (isReady(), 0);
    329329
    330     AutoLock chLock (childrenLock());
     330    AutoWriteLock chLock (childrenLock ());
    331331
    332332    ULONG count = children().size();
     
    349349    ComObjPtr <Snapshot> child;
    350350
    351     AutoLock alock (this);
     351    AutoWriteLock alock (this);
    352352    AssertReturn (isReady(), child);
    353353
     
    356356    else
    357357    {
    358         AutoLock chLock (childrenLock());
     358        AutoWriteLock chLock (childrenLock ());
    359359        for (SnapshotList::const_iterator it = children().begin();
    360360             !child && it != children().end(); ++ it)
     
    377377    AssertReturn (aName, child);
    378378
    379     AutoLock alock (this);
     379    AutoWriteLock alock (this);
    380380    AssertReturn (isReady(), child);
    381381
     
    384384    else
    385385    {
    386         AutoLock chLock (childrenLock());
     386        AutoWriteLock chLock (childrenLock ());
    387387        for (SnapshotList::const_iterator it = children().begin();
    388388             !child && it != children().end(); ++ it)
     
    398398 *  Returns @c true if the given DVD image is attached to this snapshot or any
    399399 *  of its children, recursively.
    400  * 
     400 *
    401401 *  @param aId          Image ID to check.
    402  * 
     402 *
    403403 *  @note Locks this object for reading.
    404404 */
    405405bool Snapshot::isDVDImageUsed (const Guid &aId)
    406406{
    407     AutoReaderLock alock (this);
     407    AutoReadLock alock (this);
    408408    AssertReturn (isReady(), false);
    409409
     
    423423    }
    424424
    425     AutoReaderLock chLock (childrenLock());
     425    AutoReadLock chLock (childrenLock());
    426426    for (SnapshotList::const_iterator it = children().begin();
    427427         it != children().end(); ++ it)
     
    434434}
    435435
    436 /** 
     436/**
    437437 *  Returns @c true if the given Floppy image is attached to this snapshot or any
    438438 *  of its children, recursively.
    439  * 
     439 *
    440440 *  @param aId          Image ID to check.
    441  * 
     441 *
    442442 *  @note Locks this object for reading.
    443443 */
    444444bool Snapshot::isFloppyImageUsed (const Guid &aId)
    445445{
    446     AutoReaderLock alock (this);
     446    AutoReadLock alock (this);
    447447    AssertReturn (isReady(), false);
    448448
     
    462462    }
    463463
    464     AutoReaderLock chLock (childrenLock());
     464    AutoReadLock chLock (childrenLock());
    465465    for (SnapshotList::const_iterator it = children().begin();
    466466         it != children().end(); ++ it)
     
    491491    AssertReturnVoid (aNewPath);
    492492
    493     AutoLock alock (this);
     493    AutoWriteLock alock (this);
    494494    AssertReturnVoid (isReady());
    495495
     
    506506    }
    507507
    508     AutoLock chLock (childrenLock());
     508    AutoWriteLock chLock (childrenLock ());
    509509    for (SnapshotList::const_iterator it = children().begin();
    510510         it != children().end(); ++ it)
  • trunk/src/VBox/Main/SystemPropertiesImpl.cpp

    r6096 r8083  
    6060    ComAssertRet (aParent, E_FAIL);
    6161
    62     AutoLock alock (this);
     62    AutoWriteLock alock (this);
    6363    ComAssertRet (!isReady(), E_UNEXPECTED);
    6464
     
    8484    LogFlowMember (("SystemProperties::uninit()\n"));
    8585
    86     AutoLock alock (this);
     86    AutoWriteLock alock (this);
    8787    AssertReturn (isReady(), (void) 0);
    8888
     
    9898    if (!minRAM)
    9999        return E_POINTER;
    100     AutoLock lock(this);
     100    AutoWriteLock alock (this);
    101101    CHECK_READY();
    102102
     
    110110    if (!maxRAM)
    111111        return E_POINTER;
    112     AutoLock lock(this);
     112    AutoWriteLock alock (this);
    113113    CHECK_READY();
    114114
     
    122122    if (!minVRAM)
    123123        return E_POINTER;
    124     AutoLock lock(this);
     124    AutoWriteLock alock (this);
    125125    CHECK_READY();
    126126
     
    134134    if (!maxVRAM)
    135135        return E_POINTER;
    136     AutoLock lock(this);
     136    AutoWriteLock alock (this);
    137137    CHECK_READY();
    138138
     
    146146    if (!maxMonitors)
    147147        return E_POINTER;
    148     AutoLock lock(this);
     148    AutoWriteLock alock (this);
    149149    CHECK_READY();
    150150
     
    158158    if (!maxVDISize)
    159159        return E_POINTER;
    160     AutoLock lock(this);
     160    AutoWriteLock alock (this);
    161161    CHECK_READY();
    162162
     
    179179    if (!count)
    180180        return E_POINTER;
    181     AutoLock lock (this);
     181    AutoWriteLock alock (this);
    182182    CHECK_READY();
    183183
     
    191191    if (!count)
    192192        return E_POINTER;
    193     AutoLock lock (this);
     193    AutoWriteLock alock (this);
    194194    CHECK_READY();
    195195
     
    203203    if (!count)
    204204        return E_POINTER;
    205     AutoLock lock (this);
     205    AutoWriteLock alock (this);
    206206    CHECK_READY();
    207207
     
    215215    if (!aMaxBootPosition)
    216216        return E_POINTER;
    217     AutoLock lock (this);
     217    AutoWriteLock alock (this);
    218218    CHECK_READY();
    219219
     
    228228        return E_POINTER;
    229229
    230     AutoLock alock (this);
     230    AutoWriteLock alock (this);
    231231    CHECK_READY();
    232232
     
    238238STDMETHODIMP SystemProperties::COMSETTER(DefaultVDIFolder) (INPTR BSTR aDefaultVDIFolder)
    239239{
    240     AutoLock alock (this);
     240    AutoWriteLock alock (this);
    241241    CHECK_READY();
    242242
     
    254254        return E_POINTER;
    255255
    256     AutoLock alock (this);
     256    AutoWriteLock alock (this);
    257257    CHECK_READY();
    258258
     
    264264STDMETHODIMP SystemProperties::COMSETTER(DefaultMachineFolder) (INPTR BSTR aDefaultMachineFolder)
    265265{
    266     AutoLock alock (this);
     266    AutoWriteLock alock (this);
    267267    CHECK_READY();
    268268
     
    280280        return E_POINTER;
    281281
    282     AutoLock alock (this);
     282    AutoWriteLock alock (this);
    283283    CHECK_READY();
    284284
     
    290290STDMETHODIMP SystemProperties::COMSETTER(RemoteDisplayAuthLibrary) (INPTR BSTR aRemoteDisplayAuthLibrary)
    291291{
    292     AutoLock alock (this);
     292    AutoWriteLock alock (this);
    293293    CHECK_READY();
    294294
     
    306306        return E_POINTER;
    307307
    308     AutoLock alock (this);
     308    AutoWriteLock alock (this);
    309309    CHECK_READY();
    310310
     
    316316STDMETHODIMP SystemProperties::COMSETTER(WebServiceAuthLibrary) (INPTR BSTR aWebServiceAuthLibrary)
    317317{
    318     AutoLock alock (this);
     318    AutoWriteLock alock (this);
    319319    CHECK_READY();
    320320
     
    332332        return E_POINTER;
    333333
    334     AutoLock alock (this);
     334    AutoWriteLock alock (this);
    335335    CHECK_READY();
    336336
     
    342342STDMETHODIMP SystemProperties::COMSETTER(HWVirtExEnabled) (BOOL enabled)
    343343{
    344     AutoLock alock (this);
     344    AutoWriteLock alock (this);
    345345    CHECK_READY();
    346346
     
    356356        return E_POINTER;
    357357
    358     AutoLock alock (this);
     358    AutoWriteLock alock (this);
    359359    CHECK_READY();
    360360
     
    366366STDMETHODIMP SystemProperties::COMSETTER(LogHistoryCount) (ULONG count)
    367367{
    368     AutoLock alock (this);
     368    AutoWriteLock alock (this);
    369369    CHECK_READY();
    370370
     
    382382    using namespace settings;
    383383
    384     AutoLock lock (this);
     384    AutoWriteLock alock (this);
    385385    CHECK_READY();
    386386
     
    421421    using namespace settings;
    422422
    423     AutoLock lock (this);
     423    AutoWriteLock alock (this);
    424424    CHECK_READY();
    425425
  • trunk/src/VBox/Main/USBControllerImpl.cpp

    r7992 r8083  
    113113    unconst (mPeer) = aPeer;
    114114
    115     AutoLock thatlock (aPeer);
     115    AutoWriteLock thatlock (aPeer);
    116116    mData.share (aPeer->mData);
    117117
     
    155155    /* mPeer is left null */
    156156
    157     AutoLock thatlock (aPeer);
     157    AutoWriteLock thatlock (aPeer);
    158158    mData.attachCopy (aPeer->mData);
    159159
     
    216216    CheckComRCReturnRC (autoCaller.rc());
    217217
    218     AutoReaderLock alock (this);
     218    AutoReadLock alock (this);
    219219
    220220    *aEnabled = mData->mEnabled;
     
    235235    CheckComRCReturnRC (adep.rc());
    236236
    237     AutoLock alock (this);
     237    AutoWriteLock alock (this);
    238238
    239239    if (mData->mEnabled != aEnabled)
     
    259259    CheckComRCReturnRC (autoCaller.rc());
    260260
    261     AutoReaderLock alock (this);
     261    AutoReadLock alock (this);
    262262
    263263    *aEnabled = mData->mEnabledEhci;
     
    277277    CheckComRCReturnRC (adep.rc());
    278278
    279     AutoLock alock (this);
     279    AutoWriteLock alock (this);
    280280
    281281    if (mData->mEnabledEhci != aEnabled)
     
    365365    CheckComRCReturnRC (autoCaller.rc());
    366366
    367     AutoReaderLock alock (this);
     367    AutoReadLock alock (this);
    368368
    369369    ComObjPtr <USBDeviceFilterCollection> collection;
     
    397397    CheckComRCReturnRC (adep.rc());
    398398
    399     AutoLock alock (this);
     399    AutoWriteLock alock (this);
    400400
    401401    ComObjPtr <USBDeviceFilter> filter;
     
    426426    CheckComRCReturnRC (adep.rc());
    427427
    428     AutoLock alock (this);
     428    AutoWriteLock alock (this);
    429429
    430430    ComObjPtr <USBDeviceFilter> filter = getDependentChild (aFilter);
     
    491491    CheckComRCReturnRC (adep.rc());
    492492
    493     AutoLock alock (this);
     493    AutoWriteLock alock (this);
    494494
    495495    if (!mDeviceFilters->size())
     
    566566    AssertComRCReturnRC (autoCaller.rc());
    567567
    568     AutoLock alock (this);
     568    AutoWriteLock alock (this);
    569569
    570570    /* Note: we assume that the default values for attributes of optional
     
    643643    CheckComRCReturnRC (autoCaller.rc());
    644644
    645     AutoReaderLock alock (this);
     645    AutoReadLock alock (this);
    646646
    647647    /* first, delete the entry */
     
    668668    while (it != mDeviceFilters->end())
    669669    {
    670         AutoLock filterLock (*it);
     670        AutoWriteLock filterLock (*it);
    671671        const USBDeviceFilter::Data &data = (*it)->data();
    672672
     
    725725    AssertComRCReturn (autoCaller.rc(), false);
    726726
    727     AutoReaderLock alock (this);
     727    AutoReadLock alock (this);
    728728
    729729    if (mData.isBackedUp()
     
    755755    AssertComRCReturn (autoCaller.rc(), false);
    756756
    757     AutoReaderLock alock (this);
     757    AutoReadLock alock (this);
    758758
    759759    if (mData.hasActualChanges())
     
    824824    AssertComRCReturn (adep.rc(), false);
    825825
    826     AutoLock alock (this);
     826    AutoWriteLock alock (this);
    827827
    828828    bool dataChanged = false;
     
    947947        {
    948948            /* attach new data to the peer and reshare it */
    949             AutoLock peerlock (mPeer);
     949            AutoWriteLock peerlock (mPeer);
    950950            mPeer->mData.attach (mData);
    951951        }
     
    962962        if (mPeer)
    963963        {
    964             AutoLock peerlock (mPeer);
     964            AutoWriteLock peerlock (mPeer);
    965965            /* commit all changes to new filters (this will reshare data with
    966966             * peers for those who have peers) */
     
    11811181    AssertComRCReturn (autoCaller.rc(), false);
    11821182
    1183     AutoReaderLock alock (this);
     1183    AutoReadLock alock (this);
    11841184
    11851185    /* Disabled USB controllers cannot actually work with USB devices */
     
    11921192         ++ it)
    11931193    {
    1194         AutoLock filterLock (*it);
     1194        AutoWriteLock filterLock (*it);
    11951195        if (aDevice->isMatch ((*it)->data()))
    11961196        {
     
    12221222    AssertComRCReturn (autoCaller.rc(), false);
    12231223
    1224     AutoReaderLock alock (this);
     1224    AutoReadLock alock (this);
    12251225
    12261226    /* Disabled USB controllers cannot actually work with USB devices */
     
    12901290         ++ it)
    12911291    {
    1292         AutoLock filterLock (*it);
     1292        AutoWriteLock filterLock (*it);
    12931293        const USBDeviceFilter::Data &aData = (*it)->data();
    12941294
     
    13261326    AssertComRCReturn (autoCaller.rc(), false);
    13271327
    1328     AutoReaderLock alock (this);
     1328    AutoReadLock alock (this);
    13291329
    13301330    USBProxyService *service = mParent->virtualBox()->host()->usbProxyService();
  • trunk/src/VBox/Main/USBDeviceImpl.cpp

    r5999 r8083  
    4949HRESULT OUSBDevice::init(IUSBDevice *aUSBDevice)
    5050{
    51     AutoLock lock(this);
     51    AutoWriteLock alock (this);
    5252    AssertReturn (!isReady(), E_UNEXPECTED);
    5353
     
    109109        return E_POINTER;
    110110
    111     AutoLock lock(this);
     111    AutoWriteLock alock (this);
    112112    CHECK_READY();
    113113
     
    128128        return E_POINTER;
    129129
    130     AutoLock lock(this);
     130    AutoWriteLock alock (this);
    131131    CHECK_READY();
    132132
     
    147147        return E_POINTER;
    148148
    149     AutoLock lock(this);
     149    AutoWriteLock alock (this);
    150150    CHECK_READY();
    151151
     
    166166        return E_POINTER;
    167167
    168     AutoLock lock(this);
     168    AutoWriteLock alock (this);
    169169    CHECK_READY();
    170170
     
    184184        return E_POINTER;
    185185
    186     AutoLock lock(this);
     186    AutoWriteLock alock (this);
    187187    CHECK_READY();
    188188
     
    203203        return E_POINTER;
    204204
    205     AutoLock lock(this);
     205    AutoWriteLock alock (this);
    206206    CHECK_READY();
    207207
     
    222222        return E_POINTER;
    223223
    224     AutoLock lock(this);
     224    AutoWriteLock alock (this);
    225225    CHECK_READY();
    226226
     
    241241        return E_POINTER;
    242242
    243     AutoLock lock(this);
     243    AutoWriteLock alock (this);
    244244    CHECK_READY();
    245245
     
    253253        return E_POINTER;
    254254
    255     AutoLock lock(this);
     255    AutoWriteLock alock (this);
    256256    CHECK_READY();
    257257
     
    265265        return E_POINTER;
    266266
    267     AutoLock lock(this);
     267    AutoWriteLock alock (this);
    268268    CHECK_READY();
    269269
     
    277277        return E_POINTER;
    278278
    279     AutoLock lock(this);
     279    AutoWriteLock alock (this);
    280280    CHECK_READY();
    281281
     
    289289        return E_POINTER;
    290290
    291     AutoLock lock(this);
     291    AutoWriteLock alock (this);
    292292    CHECK_READY();
    293293
  • trunk/src/VBox/Main/VirtualBoxBase.cpp

    r7992 r8083  
    2121#include <windows.h>
    2222#include <dbghelp.h>
    23 #else // !defined (VBOX_WITH_XPCOM)
     23#else /* !defined (VBOX_WITH_XPCOM) */
    2424#include <nsIServiceManager.h>
    2525#include <nsIExceptionService.h>
    26 #endif // !defined (VBOX_WITH_XPCOM)
     26#endif /* !defined (VBOX_WITH_XPCOM) */
    2727
    2828#include "VirtualBoxBase.h"
     
    5959}
    6060
    61 // AutoLock::Lockable interface
     61// util::Lockable interface
    6262RWLockHandle *VirtualBoxBaseNEXT_base::lockHandle() const
    6363{
     
    127127                                            bool aLimited /* = false */)
    128128{
    129     AutoLock stateLock (mStateLock);
     129    AutoWriteLock stateLock (mStateLock);
    130130
    131131    HRESULT rc = E_UNEXPECTED;
     
    204204void VirtualBoxBaseNEXT_base::releaseCaller()
    205205{
    206     AutoLock stateLock (mStateLock);
     206    AutoWriteLock stateLock (mStateLock);
    207207
    208208    if (mState == Ready || mState == Limited)
     
    262262    Assert (aObj);
    263263
    264     AutoLock stateLock (mObj->mStateLock);
     264    AutoWriteLock stateLock (mObj->mStateLock);
    265265
    266266    Assert (mObj->mState != InInit && mObj->mState != InUninit &&
     
    285285        return;
    286286
    287     AutoLock stateLock (mObj->mStateLock);
     287    AutoWriteLock stateLock (mObj->mStateLock);
    288288
    289289    Assert (mObj->mState == InInit);
     
    335335    Assert (aObj);
    336336
    337     AutoLock stateLock (mObj->mStateLock);
     337    AutoWriteLock stateLock (mObj->mStateLock);
    338338
    339339    Assert (mObj->mState != InInit && mObj->mState != InUninit &&
     
    358358        return;
    359359
    360     AutoLock stateLock (mObj->mStateLock);
     360    AutoWriteLock stateLock (mObj->mStateLock);
    361361
    362362    Assert (mObj->mState == InInit);
     
    397397    Assert (aObj);
    398398
    399     AutoLock stateLock (mObj->mStateLock);
     399    AutoWriteLock stateLock (mObj->mStateLock);
    400400
    401401    Assert (mObj->mState != InInit);
     
    448448        return;
    449449
    450     AutoLock stateLock (mObj->mStateLock);
     450    AutoWriteLock stateLock (mObj->mStateLock);
    451451
    452452    Assert (mObj->mState == InUninit);
     
    481481                                       const char *comment)
    482482{
    483 //    Log(("VirtualBoxBase::translate:\n"
    484 //         "  context={%s}\n"
    485 //         "  sourceT={%s}\n"
    486 //         "  comment={%s}\n",
    487 //         context, sourceText, comment));
     483#if 0
     484    Log(("VirtualBoxBase::translate:\n"
     485         "  context={%s}\n"
     486         "  sourceT={%s}\n"
     487         "  comment={%s}\n",
     488         context, sourceText, comment));
     489#endif
    488490
    489491    /// @todo (dmik) incorporate Qt translation file parsing and lookup
     
    491493    return sourceText;
    492494}
    493 
    494 /// @todo (dmik)
    495 //      Using StackWalk() is not necessary here once we have ASMReturnAddress().
    496 //      Delete later.
    497 
    498 #if defined(DEBUG) && 0
    499 
    500 //static
    501 void VirtualBoxBase::AutoLock::CritSectEnter (RTCRITSECT *aLock)
    502 {
    503     AssertReturn (aLock, (void) 0);
    504 
    505 #if (defined(RT_OS_LINUX) || defined(RT_OS_OS2)) && defined(__GNUC__)
    506 
    507     RTCritSectEnterDebug (aLock,
    508                           "AutoLock::lock()/enter() return address >>>", 0,
    509                           (RTUINTPTR) __builtin_return_address (1));
    510 
    511 #elif defined(RT_OS_WINDOWS)
    512 
    513     STACKFRAME sf;
    514     memset (&sf, 0, sizeof(sf));
    515     {
    516         __asm eip:
    517         __asm mov eax, eip
    518         __asm lea ebx, sf
    519         __asm mov [ebx]sf.AddrPC.Offset, eax
    520         __asm mov [ebx]sf.AddrStack.Offset, esp
    521         __asm mov [ebx]sf.AddrFrame.Offset, ebp
    522     }
    523     sf.AddrPC.Mode         = AddrModeFlat;
    524     sf.AddrStack.Mode      = AddrModeFlat;
    525     sf.AddrFrame.Mode      = AddrModeFlat;
    526 
    527     HANDLE process = GetCurrentProcess();
    528     HANDLE thread = GetCurrentThread();
    529 
    530     // get our stack frame
    531     BOOL ok = StackWalk (IMAGE_FILE_MACHINE_I386, process, thread,
    532                          &sf, NULL, NULL,
    533                          SymFunctionTableAccess,
    534                          SymGetModuleBase,
    535                          NULL);
    536     // sanity check of the returned stack frame
    537     ok = ok & (sf.AddrFrame.Offset != 0);
    538     if (ok)
    539     {
    540         // get the stack frame of our caller which is either
    541         // lock() or enter()
    542         ok = StackWalk (IMAGE_FILE_MACHINE_I386, process, thread,
    543                         &sf, NULL, NULL,
    544                         SymFunctionTableAccess,
    545                         SymGetModuleBase,
    546                         NULL);
    547         // sanity check of the returned stack frame
    548         ok = ok & (sf.AddrFrame.Offset != 0);
    549     }
    550 
    551     if (ok)
    552     {
    553         // the return address here should be the code where lock() or enter()
    554         // has been called from (to be more precise, where it will return)
    555         RTCritSectEnterDebug (aLock,
    556                               "AutoLock::lock()/enter() return address >>>", 0,
    557                               (RTUINTPTR) sf.AddrReturn.Offset);
    558     }
    559     else
    560     {
    561         RTCritSectEnter (aLock);
    562     }
    563 
    564 #else
    565 
    566     RTCritSectEnter (aLock);
    567 
    568 #endif // defined(RT_OS_LINUX)...
    569 }
    570 
    571 #endif // defined(DEBUG)
    572495
    573496// VirtualBoxSupportTranslationBase methods
     
    827750    LogFlowThisFuncEnter();
    828751
    829     AutoLock alock (this);
    830     AutoLock mapLock (mMapLock);
     752    AutoWriteLock alock (this);
     753    AutoWriteLock mapLock (mMapLock);
    831754
    832755    LogFlowThisFunc (("count=%d...\n", mDependentChildren.size()));
     
    899822    AssertReturn (!!unk, NULL);
    900823
    901     AutoLock alock (mMapLock);
     824    AutoWriteLock alock (mMapLock);
    902825    if (mUninitDoneSem != NIL_RTSEMEVENT)
    903826        return NULL;
     
    915838    AssertReturn (!!unk && child, (void) 0);
    916839
    917     AutoLock alock (mMapLock);
     840    AutoWriteLock alock (mMapLock);
    918841
    919842    if (mUninitDoneSem != NIL_RTSEMEVENT)
     
    938861    AssertReturn (!!unk, (void) 0);
    939862
    940     AutoLock alock (mMapLock);
     863    AutoWriteLock alock (mMapLock);
    941864
    942865    if (mUninitDoneSem != NIL_RTSEMEVENT)
     
    975898    LogFlowThisFuncEnter();
    976899
    977     AutoLock mapLock (mMapLock);
     900    AutoWriteLock mapLock (mMapLock);
    978901
    979902    LogFlowThisFunc (("count=%u...\n", mDependentChildren.size()));
     
    1045968    AssertReturn (!!aUnk, NULL);
    1046969
    1047     AutoLock alock (mMapLock);
     970    AutoWriteLock alock (mMapLock);
    1048971
    1049972    /* return NULL if uninitDependentChildren() is in action */
     
    1062985    AssertReturnVoid (aUnk && aChild);
    1063986
    1064     AutoLock alock (mMapLock);
     987    AutoWriteLock alock (mMapLock);
    1065988
    1066989    if (mUninitDoneSem != NIL_RTSEMEVENT)
     
    10821005    AssertReturnVoid (aUnk);
    10831006
    1084     AutoLock alock (mMapLock);
     1007    AutoWriteLock alock (mMapLock);
    10851008
    10861009    if (mUninitDoneSem != NIL_RTSEMEVENT)
     
    11201043void VirtualBoxBaseWithTypedChildrenNEXT <C>::uninitDependentChildren()
    11211044{
    1122     AutoLock mapLock (mMapLock);
     1045    AutoWriteLock mapLock (mMapLock);
    11231046
    11241047    if (mDependentChildren.size())
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r8055 r8083  
    489489    CheckComRCReturnRC (autoCaller.rc());
    490490
    491     AutoReaderLock alock (this);
     491    AutoReadLock alock (this);
    492492
    493493    mData.mSettingsFileVersion.cloneTo (aSettingsFileVersion);
     
    547547    collection.createObject();
    548548
    549     AutoReaderLock alock (this);
     549    AutoReadLock alock (this);
    550550    collection->init (mData.mMachines);
    551551    collection.queryInterfaceTo (aMachines);
     
    566566    CheckComRCReturnRC (autoCaller.rc());
    567567
    568     AutoReaderLock alock (this);
     568    AutoReadLock alock (this);
    569569
    570570    SafeIfaceArray <IMachine> machines (mData.mMachines);
     
    588588    collection.createObject();
    589589
    590     AutoReaderLock alock (this);
     590    AutoReadLock alock (this);
    591591    collection->init (mData.mHardDisks);
    592592    collection.queryInterfaceTo (aHardDisks);
     
    609609    collection.createObject();
    610610
    611     AutoReaderLock alock (this);
     611    AutoReadLock alock (this);
    612612    collection->init (mData.mDVDImages);
    613613    collection.queryInterfaceTo (aDVDImages);
     
    630630    collection.createObject();
    631631
    632     AutoReaderLock alock (this);
     632    AutoReadLock alock (this);
    633633    collection->init (mData.mFloppyImages);
    634634    collection.queryInterfaceTo (aFloppyImages);
     
    651651    collection.createObject();
    652652
    653     AutoReaderLock alock (this);
     653    AutoReadLock alock (this);
    654654    collection->init (mData.mProgressOperations);
    655655    collection.queryInterfaceTo (aOperations);
     
    672672    collection.createObject();
    673673
    674     AutoReaderLock alock (this);
     674    AutoReadLock alock (this);
    675675    collection->init (mData.mGuestOSTypes);
    676676    collection.queryInterfaceTo (aGuestOSTypes);
     
    726726    if (settingsFile.isEmpty())
    727727    {
    728         AutoReaderLock propsLock (systemProperties());
     728        AutoReadLock propsLock (systemProperties());
    729729        /* we use the non-full folder value below to keep the path relative */
    730730        settingsFile = systemProperties()->defaultMachineFolder();
     
    926926    {
    927927        /* take a copy for safe iteration outside the lock */
    928         AutoReaderLock alock (this);
     928        AutoReadLock alock (this);
    929929        machines = mData.mMachines;
    930930    }
     
    940940        if (machCaller.state() == Machine::Ready)
    941941        {
    942             AutoReaderLock machLock (*it);
     942            AutoReadLock machLock (*it);
    943943            if ((*it)->name() == aName)
    944944                machine = *it;
     
    971971    CheckComRCReturnRC (autoCaller.rc());
    972972
    973     AutoLock alock (this);
     973    AutoWriteLock alock (this);
    974974
    975975    ComObjPtr <Machine> machine;
     
    10831083        if (!RTPathHavePath (loc))
    10841084        {
    1085             AutoLock propsLock (mData.mSystemProperties);
     1085            AutoWriteLock propsLock (mData.mSystemProperties);
    10861086            location = Utf8StrFmt ("%ls%c%s",
    10871087                                   mData.mSystemProperties->defaultVDIFolder().raw(),
     
    11191119        if (!RTPathHavePath (fp))
    11201120        {
    1121             AutoLock propsLock (mData.mSystemProperties);
     1121            AutoWriteLock propsLock (mData.mSystemProperties);
    11221122            path = Utf8StrFmt ("%ls%c%s",
    11231123                               mData.mSystemProperties->defaultVDIFolder().raw(),
     
    12011201        if (!RTPathHavePath (location))
    12021202        {
    1203             AutoLock propsLock (mData.mSystemProperties);
     1203            AutoWriteLock propsLock (mData.mSystemProperties);
    12041204            location = Utf8StrFmt ("%ls%c%s",
    12051205                                   mData.mSystemProperties->defaultVDIFolder().raw(),
     
    12451245        if (!RTPathHavePath (fp))
    12461246        {
    1247             AutoLock propsLock (mData.mSystemProperties);
     1247            AutoWriteLock propsLock (mData.mSystemProperties);
    12481248            path = Utf8StrFmt ("%ls%c%s",
    12491249                               mData.mSystemProperties->defaultVDIFolder().raw(),
     
    14051405    CheckComRCReturnRC (autoCaller.rc());
    14061406
    1407     AutoReaderLock alock (this);
     1407    AutoReadLock alock (this);
    14081408
    14091409    Guid uuid = Guid (aId);
     
    14291429    CheckComRCReturnRC (autoCaller.rc());
    14301430
    1431     AutoLock alock (this);
     1431    AutoWriteLock alock (this);
    14321432
    14331433    *aDVDImage = NULL;
     
    15741574    CheckComRCReturnRC (autoCaller.rc());
    15751575
    1576     AutoReaderLock alock (this);
     1576    AutoReadLock alock (this);
    15771577
    15781578    Guid uuid = Guid (aId);
     
    15981598    CheckComRCReturnRC (autoCaller.rc());
    15991599
    1600     AutoLock alock (this);
     1600    AutoWriteLock alock (this);
    16011601
    16021602    *aFloppyImage = NULL;
     
    16391639    *aType = NULL;
    16401640
    1641     AutoReaderLock alock (this);
     1641    AutoReadLock alock (this);
    16421642
    16431643    for (GuestOSTypeList::iterator it = mData.mGuestOSTypes.begin();
     
    17031703
    17041704    /* serialize file access (prevent writes) */
    1705     AutoReaderLock alock (this);
     1705    AutoReadLock alock (this);
    17061706
    17071707    try
     
    18011801
    18021802    /* serialize file access (prevent writes) */
    1803     AutoReaderLock alock (this);
     1803    AutoReadLock alock (this);
    18041804
    18051805    try
     
    18611861
    18621862    /* serialize file access (prevent concurrent reads and writes) */
    1863     AutoLock alock (this);
     1863    AutoWriteLock alock (this);
    18641864
    18651865    try
     
    21032103    CheckComRCReturnRC (autoCaller.rc());
    21042104
    2105     AutoLock alock (this);
     2105    AutoWriteLock alock (this);
    21062106    mData.mCallbacks.push_back (CallbackList::value_type (aCallback));
    21072107
     
    21222122    HRESULT rc = S_OK;
    21232123
    2124     AutoLock alock (this);
     2124    AutoWriteLock alock (this);
    21252125
    21262126    CallbackList::iterator it;
     
    21602160
    21612161    /* saveSettings() needs write lock */
    2162     AutoLock alock (this);
     2162    AutoWriteLock alock (this);
    21632163
    21642164    /* perform backup only when there was auto-conversion */
     
    22122212    AssertReturn (mAsyncEventQ, E_FAIL);
    22132213
    2214     AutoLock alock (mAsyncEventQLock);
     2214    AutoWriteLock alock (mAsyncEventQLock);
    22152215    if (mAsyncEventQ->postEvent (event))
    22162216        return S_OK;
     
    22362236    CheckComRCReturnRC (autoCaller.rc());
    22372237
    2238     AutoLock alock (this);
     2238    AutoWriteLock alock (this);
    22392239    mData.mProgressOperations.push_back (aProgress);
    22402240    return S_OK;
     
    22572257    ComPtr <IProgress> progress;
    22582258
    2259     AutoLock alock (this);
     2259    AutoWriteLock alock (this);
    22602260
    22612261    for (ProgressList::iterator it = mData.mProgressOperations.begin();
     
    25492549    /// @todo (dmik) Win32?
    25502550#ifndef RT_OS_WINDOWS
    2551     AutoLock alock (this);
     2551    AutoWriteLock alock (this);
    25522552    mWatcherData.mProcesses.push_back (pid);
    25532553#endif
     
    26332633    CallbackList list;
    26342634    {
    2635         AutoReaderLock alock (this);
     2635        AutoReadLock alock (this);
    26362636        list = mData.mCallbacks;
    26372637    }
     
    27962796    AssertComRCReturn (autoCaller.rc(), type);
    27972797
    2798     AutoReaderLock alock (this);
     2798    AutoReadLock alock (this);
    27992799
    28002800    /* unknown type must always be the first */
     
    28262826
    28272827    {
    2828         AutoReaderLock alock (this);
     2828        AutoReadLock alock (this);
    28292829
    28302830        for (MachineList::iterator it = mData.mMachines.begin();
     
    28742874
    28752875    {
    2876         AutoReaderLock alock (this);
     2876        AutoReadLock alock (this);
    28772877
    28782878        for (MachineList::const_iterator mit = mData.mMachines.begin();
     
    29612961
    29622962    {
    2963         AutoReaderLock alock (this);
     2963        AutoReadLock alock (this);
    29642964
    29652965        for (MachineList::const_iterator mit = mData.mMachines.begin();
     
    30773077
    30783078    {
    3079         AutoReaderLock alock (this);
     3079        AutoReadLock alock (this);
    30803080
    30813081        for (MachineList::iterator it = mData.mMachines.begin();
     
    31293129    ComAssertRet (aId || aLocation, E_INVALIDARG);
    31303130
    3131     AutoReaderLock alock (this);
     3131    AutoReadLock alock (this);
    31323132
    31333133    /* first lookup the map by UUID if UUID is provided */
     
    31543154        {
    31553155            const ComObjPtr <HardDisk> &hd = (*it).second;
    3156             AutoReaderLock hdLock (hd);
     3156            AutoReadLock hdLock (hd);
    31573157
    31583158            if (hd->storageType() == HardDiskStorageType_VirtualDiskImage ||
     
    32173217    ComAssertRet (aId || aFilePathFull, E_INVALIDARG);
    32183218
    3219     AutoReaderLock alock (this);
     3219    AutoReadLock alock (this);
    32203220
    32213221    /* first lookup the map by UUID if UUID is provided */
     
    32253225        if (it != mData.mHardDiskMap.end())
    32263226        {
    3227             AutoReaderLock hdLock ((*it).second);
     3227            AutoReadLock hdLock ((*it).second);
    32283228            if ((*it).second->storageType() == HardDiskStorageType_VirtualDiskImage)
    32293229            {
     
    32443244        {
    32453245            const ComObjPtr <HardDisk> &hd = (*it).second;
    3246             AutoReaderLock hdLock (hd);
     3246            AutoReadLock hdLock (hd);
    32473247            if (hd->storageType() != HardDiskStorageType_VirtualDiskImage)
    32483248                continue;
     
    33003300
    33013301    {
    3302         AutoReaderLock alock (this);
     3302        AutoReadLock alock (this);
    33033303
    33043304        for (DVDImageList::const_iterator it = mData.mDVDImages.begin();
     
    33613361
    33623362    {
    3363         AutoReaderLock alock (this);
     3363        AutoReadLock alock (this);
    33643364
    33653365        for (FloppyImageList::iterator it = mData.mFloppyImages.begin();
     
    34223422    HRESULT rc = S_OK;
    34233423
    3424     AutoReaderLock alock (this);
     3424    AutoReadLock alock (this);
    34253425
    34263426    if (aHardDisk)
     
    37163716
    37173717    /* serialize file access (prevent concurrent reads and writes) */
    3718     AutoLock alock (this);
     3718    AutoWriteLock alock (this);
    37193719
    37203720    try
     
    38403840    HRESULT rc = S_OK;
    38413841
    3842     AutoReaderLock alock (this);
     3842    AutoReadLock alock (this);
    38433843
    38443844    for (HardDiskList::const_iterator it = mData.mHardDisks.begin();
     
    38473847    {
    38483848        ComObjPtr <HardDisk> hd = *it;
    3849         AutoReaderLock hdLock (hd);
     3849        AutoReadLock hdLock (hd);
    38503850
    38513851        Key hdNode = aNode.appendKey ("HardDisk");
     
    39163916    CheckComRCReturnRC (autoCaller.rc());
    39173917
    3918     AutoLock alock (this);
     3918    AutoWriteLock alock (this);
    39193919
    39203920    HRESULT rc = S_OK;
     
    39693969    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    39703970
    3971     AutoLock alock (this);
     3971    AutoWriteLock alock (this);
    39723972
    39733973    HRESULT rc = checkMediaForConflicts (aHardDisk, NULL, NULL);
     
    40184018    LogFlowThisFunc (("image='%ls'\n", aHardDisk->toString().raw()));
    40194019
    4020     AutoLock alock (this);
     4020    AutoWriteLock alock (this);
    40214021
    40224022    /* Lock the hard disk to ensure nobody registers it again before we delete
    40234023     * the differencing image (sanity check actually -- should never happen). */
    4024     AutoLock hdLock (aHardDisk);
     4024    AutoWriteLock hdLock (aHardDisk);
    40254025
    40264026    /* try to unregister */
     
    40774077    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    40784078
    4079     AutoLock alock (this);
     4079    AutoWriteLock alock (this);
    40804080
    40814081    /*
     
    40834083     *  will be locked by #unregisterHardDisk().
    40844084     */
    4085     AutoLock hdLock (aHardDisk);
     4085    AutoWriteLock hdLock (aHardDisk);
    40864086
    40874087    AssertReturn (aHardDisk->isDifferencing(), E_INVALIDARG);
     
    41174117    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    41184118
    4119     AutoLock alock (this);
     4119    AutoWriteLock alock (this);
    41204120
    41214121    size_t oldPathLen = strlen (aOldPath);
     
    44094409    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    44104410
    4411     AutoLock alock (this);
     4411    AutoWriteLock alock (this);
    44124412
    44134413    HRESULT rc = checkMediaForConflicts (NULL, &aImage->id(),
     
    44424442    AssertComRCReturn (autoCaller.rc(), autoCaller.rc());
    44434443
    4444     AutoLock alock (this);
     4444    AutoWriteLock alock (this);
    44454445
    44464446    HRESULT rc = checkMediaForConflicts (NULL, &aImage->id(),
     
    47714771#ifdef DEBUG
    47724772                            {
    4773                                 AutoReaderLock machieLock (machines [semId]);
     4773                                AutoReadLock machieLock (machines [semId]);
    47744774                                LogFlowFunc (("released mutex: machine='%ls'\n",
    47754775                                              machines [semId]->name().raw()));
     
    48014801#ifdef DEBUG
    48024802                                    {
    4803                                         AutoReaderLock machieLock (machines [semId]);
     4803                                        AutoReadLock machieLock (machines [semId]);
    48044804                                        LogFlowFunc (("mutex owner dead: machine='%ls'\n",
    48054805                                                      machines [i]->name().raw()));
     
    49004900            /* reap child processes */
    49014901            {
    4902                 AutoLock alock (that);
     4902                AutoWriteLock alock (that);
    49034903                if (that->mWatcherData.mProcesses.size())
    49044904                {
     
    50155015    {
    50165016        /* Make a copy to release the lock before iterating */
    5017         AutoReaderLock alock (mVirtualBox);
     5017        AutoReadLock alock (mVirtualBox);
    50185018        callbacks = CallbackVector (mVirtualBox->mData.mCallbacks.begin(),
    50195019                                    mVirtualBox->mData.mCallbacks.end());
  • trunk/src/VBox/Main/include/AudioAdapterImpl.h

    r7207 r8083  
    9090    HRESULT saveSettings (settings::Key &aMachineNode);
    9191
    92     bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
    93     bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
     92    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
     93    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
    9494    bool rollback();
    9595    void commit();
  • trunk/src/VBox/Main/include/AutoLock.h

    r7992 r8083  
    11/** @file
    22 *
    3  * AutoLock: smart critical section wrapper
     3 * AutoWriteLock/AutoReadLock: smart R/W semaphore wrappers
    44 */
    55
     
    3535
    3636/**
    37  * Abstract lock operations. See LockHandle and AutoLock for details.
     37 * Abstract lock operations. See LockHandle and AutoWriteLock for details.
    3838 */
    3939class LockOps
     
    4848
    4949/**
    50  * Read lock operations. See LockHandle and AutoLock for details.
     50 * Read lock operations. See LockHandle and AutoWriteLock for details.
    5151 */
    5252class ReadLockOps : public LockOps
     
    7070
    7171/**
    72  * Write lock operations. See LockHandle and AutoLock for details.
     72 * Write lock operations. See LockHandle and AutoWriteLock for details.
    7373 */
    7474class WriteLockOps : public LockOps
     
    9898 * with pure methods of ReadLockOps and WriteLockOps classes.
    9999 *
    100  * See the AutoLock class documentation for the detailed description of read and
    101  * write locks.
     100 * See the AutoWriteLock class documentation for the detailed description of
     101 * read and write locks.
    102102 */
    103103class LockHandle : protected ReadLockOps, protected WriteLockOps
     
    112112     * read/write semaphore. Intended for debugging only.
    113113     */
    114     virtual bool isLockedOnCurrentThread() const = 0;
     114    virtual bool isWriteLockOnCurrentThread() const = 0;
    115115
    116116    /**
     
    140140    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (LockHandle)
    141141
    142     friend class AutoLock;
    143     friend class AutoReaderLock;
     142    friend class AutoWriteLock;
     143    friend class AutoReadLock;
    144144};
    145145
     
    148148 *
    149149 * This is an auxiliary base class for classes that need full-featured
    150  * read/write locking as described in the AutoLock class documentation.
     150 * read/write locking as described in the AutoWriteLock class documentation.
    151151 * Instances of classes inherited from this class can be passed as arguments to
    152  * the AutoLock and AutoReaderLock constructors.
     152 * the AutoWriteLock and AutoReadLock constructors.
    153153 */
    154154class RWLockHandle : public LockHandle
     
    159159    virtual ~RWLockHandle();
    160160
    161     bool isLockedOnCurrentThread() const;
     161    bool isWriteLockOnCurrentThread() const;
    162162
    163163private:
     
    191191 * which makes a lockRead() call fully equivalent to the lockWrite() call and
    192192 * therefore makes it pointless to use instahces of this class with
    193  * AutoReaderLock instances -- shared locking will not be possible anyway and
     193 * AutoReadLock instances -- shared locking will not be possible anyway and
    194194 * any call to lock() will block if there are lock owners on other threads.
    195195 *
     
    210210    }
    211211
    212     bool isLockedOnCurrentThread() const
     212    bool isWriteLockOnCurrentThread() const
    213213    {
    214214        return RTCritSectIsOwner (&mCritSect);
     
    259259
    260260    /**
    261      * Returns a pointer to a LockHandle used by AutoLock/AutoReaderLock for
    262      * locking. Subclasses are allowed to return @c NULL -- in this case,
    263      * the AutoLock/AutoReaderLock object constructed using an instance of
     261     * Returns a pointer to a LockHandle used by AutoWriteLock/AutoReadLock
     262     * for locking. Subclasses are allowed to return @c NULL -- in this case,
     263     * the AutoWriteLock/AutoReadLock object constructed using an instance of
    264264     * such subclass will simply turn into no-op.
    265265     */
     
    267267
    268268    /**
    269      * Equivalent to <tt>#lockHandle()->isLockedOnCurrentThread()</tt>.
     269     * Equivalent to <tt>#lockHandle()->isWriteLockOnCurrentThread()</tt>.
    270270     * Returns @c false if lockHandle() returns @c NULL.
    271271     */
    272     bool isLockedOnCurrentThread()
     272    bool isWriteLockOnCurrentThread()
    273273    {
    274274        LockHandle *h = lockHandle();
    275         return h ? h->isLockedOnCurrentThread() : false;
     275        return h ? h->isWriteLockOnCurrentThread() : false;
    276276    }
    277277
     
    329329 * <b>deadlock</b> (i.e. it will block forever waiting for itself).
    330330 *
    331  * Note that instances of the AutoLock class manage write locks of read/write
    332  * semaphores only. In order to manage read locks, please use the AutoReaderLock
    333  * class.
     331 * Note that instances of the AutoWriteLock class manage write locks of
     332 * read/write semaphores only. In order to manage read locks, please use the
     333 * AutoReadLock class.
    334334 *
    335335 * Safe semaphore management consists of the following:
    336336 * <ul>
    337  *   <li>When an instance of the AutoLock class is constructed given a valid
    338  *   semaphore handle, it will automatically request a write lock on that
     337 *   <li>When an instance of the AutoWriteLock class is constructed given a
     338 *   valid semaphore handle, it will automatically request a write lock on that
    339339 *   semaphore.
    340340 *   </li>
    341  *   <li>When an instance of the AutoLock class constructed given a valid
     341 *   <li>When an instance of the AutoWriteLock class constructed given a valid
    342342 *   semaphore handle is destroyed (e.g. goes out of scope), it will
    343343 *   automatically release the write lock that was requested upon construction
    344344 *   and also all nested write locks requested later using the #lock() call
    345345 *   (note that the latter is considered to be a program logic error, see the
    346  *   #~AutoLock() description for details).
     346 *   #~AutoWriteLock() description for details).
    347347 *   </li>
    348348 * </ul>
    349349 *
    350  * Note that the LockHandle class taken by AutoLock constructors is an abstract
    351  * base of the read/write semaphore. You should choose one of the existing
    352  * subclasses of this abstract class or create your own subclass that implements
    353  * necessary read and write lock semantics. The most suitable choice is the
    354  * RWLockHandle class which provides full support for both read and write locks
    355  * as describerd above. Alternatively, you can use the WriteLockHandle class if
    356  * you only need write (exclusive) locking (WriteLockHandle requires less system
    357  * resources and works faster).
    358  *
    359  * A typical usage pattern of the AutoLock class is as follows:
     350 * Note that the LockHandle class taken by AutoWriteLock constructors is an
     351 * abstract base of the read/write semaphore. You should choose one of the
     352 * existing subclasses of this abstract class or create your own subclass that
     353 * implements necessary read and write lock semantics. The most suitable choice
     354 * is the RWLockHandle class which provides full support for both read and write
     355 * locks as describerd above. Alternatively, you can use the WriteLockHandle
     356 * class if you only need write (exclusive) locking (WriteLockHandle requires
     357 * less system resources and works faster).
     358 *
     359 * A typical usage pattern of the AutoWriteLock class is as follows:
    360360 * <code>
    361361 *  struct Struct : public RWLockHandle
     
    368368 *      {
    369369 *          // acquire a write lock of aStruct
    370  *          AutoLock alock (aStruct);
     370 *          AutoWriteLock alock (aStruct);
    371371 *
    372372 *          // now we can modify aStruct in a thread-safe manner
     
    393393 * <code>
    394394 *  Thread 1:
    395  *    #1: AutoLock (mFoo);
     395 *    #1: AutoWriteLock (mFoo);
    396396 *        ...
    397  *    #2: AutoLock (mBar);
     397 *    #2: AutoWriteLock (mBar);
    398398 *        ...
    399399 *  Thread 2:
    400  *    #3: AutoLock (mBar);
     400 *    #3: AutoWriteLock (mBar);
    401401 *        ...
    402  *    #4: AutoLock (mFoo);
     402 *    #4: AutoWriteLock (mFoo);
    403403 *        ...
    404404 * </code>
     
    425425 * whole application so the human factor applies. Taking the simplicity of this
    426426 * method into account, it is chosen to solve potential deadlock problems when
    427  * using AutoLock and AutoReaderLock classes. Here are the locking rules that
    428  * must be obeyed by <b>all</b> users of these classes. Note that if more than
    429  * one rule matches the given group of objects to lock, all of these rules must
    430  * be met:
     427 * using AutoWriteLock and AutoReadLock classes. Here are the locking rules
     428 * that must be obeyed by <b>all</b> users of these classes. Note that if more
     429 * than one rule matches the given group of objects to lock, all of these rules
     430 * must be met:
    431431 * <ol>
    432432 *     <li>If there is a parent-child (or master-slave) relationship between the
     
    455455 * per every object).
    456456 */
    457 class AutoLock
     457class AutoWriteLock
    458458{
    459459public:
     
    467467     * runtime.
    468468     */
    469     AutoLock() : mHandle (NULL), mLockLevel (0), mGlobalLockLevel (0) {}
     469    AutoWriteLock() : mHandle (NULL), mLockLevel (0), mGlobalLockLevel (0) {}
    470470
    471471    /**
     
    473473     * semaphore by requesting a write lock.
    474474     */
    475     AutoLock (LockHandle *aHandle)
     475    AutoWriteLock (LockHandle *aHandle)
    476476        : mHandle (aHandle), mLockLevel (0), mGlobalLockLevel (0)
    477477    { lock(); }
     
    481481     * semaphore by requesting a write lock.
    482482     */
    483     AutoLock (LockHandle &aHandle)
     483    AutoWriteLock (LockHandle &aHandle)
    484484        : mHandle (&aHandle), mLockLevel (0), mGlobalLockLevel (0)
    485485    { lock(); }
     
    489489     * semaphore by requesting a write lock.
    490490     */
    491     AutoLock (const Lockable &aLockable)
     491    AutoWriteLock (const Lockable &aLockable)
    492492        : mHandle (aLockable.lockHandle()), mLockLevel (0), mGlobalLockLevel (0)
    493493    { lock(); }
     
    497497     * semaphore by requesting a write lock.
    498498     */
    499     AutoLock (const Lockable *aLockable)
     499    AutoWriteLock (const Lockable *aLockable)
    500500        : mHandle (aLockable ? aLockable->lockHandle() : NULL)
    501501        , mLockLevel (0), mGlobalLockLevel (0)
     
    511511     * is a program logic error which must be fixed.
    512512     */
    513     ~AutoLock()
     513    ~AutoWriteLock()
    514514    {
    515515        if (mHandle)
     
    568568     * This implies that all nested write locks on the semaphore will be
    569569     * released, even those that were acquired through the calls to #lock()
    570      * methods of all other AutoLock/AutoReaderLock instances managing the
     570     * methods of all other AutoWriteLock/AutoReadLock instances managing the
    571571     * <b>same</b> read/write semaphore.
    572572     *
     
    579579     * called minus the number of nested #lock() calls made on this instance
    580580     * itself. This is done to preserve lock levels of other
    581      * AutoLock/AutoReaderLock instances managing the same semaphore (if any).
    582      * Tiis also means that the destructor may indefinitely block if a write or
    583      * a read lock is owned by some other thread by that time.
     581     * AutoWriteLock/AutoReadLock instances managing the same semaphore (if
     582     * any). Tiis also means that the destructor may indefinitely block if a
     583     * write or a read lock is owned by some other thread by that time.
    584584     */
    585585    void leave()
     
    627627     * @note Intended for debugging only.
    628628     */
    629     bool isLockedOnCurrentThread() const
    630     {
    631         return mHandle ? mHandle->isLockedOnCurrentThread() : false;
     629    bool isWriteLockOnCurrentThread() const
     630    {
     631        return mHandle ? mHandle->isWriteLockOnCurrentThread() : false;
    632632    }
    633633
     
    684684private:
    685685
    686     DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoLock)
    687     DECLARE_CLS_NEW_DELETE_NOOP (AutoLock)
     686    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoWriteLock)
     687    DECLARE_CLS_NEW_DELETE_NOOP (AutoWriteLock)
    688688
    689689    LockHandle *mHandle;
     
    699699 * Provides safe management of read/write semaphores in read mode.
    700700 *
    701  * This class differs from the AutoLock class is so that it's #lock() and
     701 * This class differs from the AutoWriteLock class is so that it's #lock() and
    702702 * #unlock() methods requests and release read (shared) locks on the managed
    703  * read/write semaphore instead of write (exclusive) locks. See the AutoLock
    704  * class description for more information about read and write locks.
     703 * read/write semaphore instead of write (exclusive) locks. See the
     704 * AutoWriteLock class description for more information about read and write
     705 * locks.
    705706 *
    706707 * Safe semaphore management consists of the following:
    707708 * <ul>
    708  *   <li>When an instance of the AutoReaderLock class is constructed given a
     709 *   <li>When an instance of the AutoReadLock class is constructed given a
    709710 *   valid semaphore handle, it will automatically request a read lock on that
    710711 *   semaphore.
    711712 *   </li>
    712  *   <li>When an instance of the AutoReaderLock class constructed given a valid
     713 *   <li>When an instance of the AutoReadLock class constructed given a valid
    713714 *   semaphore handle is destroyed (e.g. goes out of scope), it will
    714715 *   automatically release the read lock that was requested upon construction
    715716 *   and also all nested read locks requested later using the #lock() call (note
    716717 *   that the latter is considered to be a program logic error, see the
    717  *   #~AutoReaderLock() description for details).
     718 *   #~AutoReadLock() description for details).
    718719 *   </li>
    719720 * </ul>
    720721 *
    721  * Note that the LockHandle class taken by AutoReaderLock constructors is an
     722 * Note that the LockHandle class taken by AutoReadLock constructors is an
    722723 * abstract base of the read/write semaphore. You should choose one of the
    723724 * existing subclasses of this abstract class or create your own subclass that
    724725 * implements necessary read and write lock semantics. The most suitable choice
    725726 * is the RWLockHandle class which provides full support for both read and write
    726  * locks as describerd in AutoLock docs. Alternatively, you can use the
     727 * locks as describerd in AutoWriteLock docs. Alternatively, you can use the
    727728 * WriteLockHandle class if you only need write (exclusive) locking
    728729 * (WriteLockHandle requires less system resources and works faster).
    729730 *
    730731 * However, please note that it absolutely does not make sense to manage
    731  * WriteLockHandle semaphores with AutoReaderLock instances because
    732  * AutoReaderLock instances will behave like AutoLock instances in this case
    733  * since WriteLockHandle provides only exclusive write locking. You have been
    734  * warned.
    735 
    736  * A typical usage pattern of the AutoReaderLock class is as follows:
     732 * WriteLockHandle semaphores with AutoReadLock instances because
     733 * AutoReadLock instances will behave like AutoWriteLock instances in this
     734 * case since WriteLockHandle provides only exclusive write locking. You have
     735 * been warned.
     736
     737 * A typical usage pattern of the AutoReadLock class is as follows:
    737738 * <code>
    738739 *  struct Struct : public RWLockHandle
     
    746747 *          // acquire a read lock of aStruct (note that two foo() calls may be
    747748 *          executed on separate threads simultaneously w/o blocking each other)
    748  *          AutoReaderLock alock (aStruct);
     749 *          AutoReadLock alock (aStruct);
    749750 *
    750751 *          // now we can read aStruct in a thread-safe manner
     
    764765 * </code>
    765766 */
    766 class AutoReaderLock
     767class AutoReadLock
    767768{
    768769public:
     
    776777     * runtime.
    777778     */
    778     AutoReaderLock() : mHandle (NULL), mLockLevel (0) {}
     779    AutoReadLock() : mHandle (NULL), mLockLevel (0) {}
    779780
    780781    /**
     
    782783     * semaphore by requesting a read lock.
    783784     */
    784     AutoReaderLock (LockHandle *aHandle)
     785    AutoReadLock (LockHandle *aHandle)
    785786        : mHandle (aHandle), mLockLevel (0)
    786787    { lock(); }
     
    790791     * semaphore by requesting a read lock.
    791792     */
    792     AutoReaderLock (LockHandle &aHandle)
     793    AutoReadLock (LockHandle &aHandle)
    793794        : mHandle (&aHandle), mLockLevel (0)
    794795    { lock(); }
     
    798799     * semaphore by requesting a read lock.
    799800     */
    800     AutoReaderLock (const Lockable &aLockable)
     801    AutoReadLock (const Lockable &aLockable)
    801802        : mHandle (aLockable.lockHandle()), mLockLevel (0)
    802803    { lock(); }
     
    806807     * semaphore by requesting a read lock.
    807808     */
    808     AutoReaderLock (const Lockable *aLockable)
     809    AutoReadLock (const Lockable *aLockable)
    809810        : mHandle (aLockable ? aLockable->lockHandle() : NULL)
    810811        , mLockLevel (0)
     
    820821     * is a program logic error which must be fixed.
    821822     */
    822     ~AutoReaderLock()
     823    ~AutoReadLock()
    823824    {
    824825        if (mHandle)
     
    908909private:
    909910
    910     DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoReaderLock)
    911     DECLARE_CLS_NEW_DELETE_NOOP (AutoReaderLock)
     911    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoReadLock)
     912    DECLARE_CLS_NEW_DELETE_NOOP (AutoReadLock)
    912913
    913914    LockHandle *mHandle;
     
    10301031 *      AutoMultiLock2 multiLock (data1.wlock(), data2.rlock());
    10311032 *      // both locks are held here:
    1032  *      // - data1 is locked in write mode (like AutoLock)
    1033  *      // - data2 is locked in read mode (like AutoReaderLock)
     1033 *      // - data1 is locked in write mode (like AutoWriteLock)
     1034 *      // - data2 is locked in read mode (like AutoReadLock)
    10341035 *  }
    10351036 *  // both locks are released here
     
    10751076
    10761077    /**
    1077      * Calls AutoLock::lock() methods for all managed semaphore handles in order
    1078      * they were passed to the constructor.
     1078     * Calls AutoWriteLock::lock() methods for all managed semaphore handles in
     1079     * order they were passed to the constructor.
    10791080     */
    10801081    void lock()
     
    10861087
    10871088    /**
    1088      * Calls AutoLock::unlock() methods for all managed semaphore handles in
    1089      * reverse to the order they were passed to the constructor.
     1089     * Calls AutoWriteLock::unlock() methods for all managed semaphore handles
     1090     * in reverse to the order they were passed to the constructor.
    10901091     */
    10911092    void unlock()
     
    10991100
    11001101    /**
    1101      * Calls AutoLock::leave() methods for all managed semaphore handles in
     1102     * Calls AutoWriteLock::leave() methods for all managed semaphore handles in
    11021103     * reverse to the order they were passed to the constructor.
    11031104     */
     
    11121113
    11131114    /**
    1114      * Calls AutoLock::enter() methods for all managed semaphore handles in order
    1115      * they were passed to the constructor.
     1115     * Calls AutoWriteLock::enter() methods for all managed semaphore handles in
     1116     * order they were passed to the constructor.
    11161117     */
    11171118    void enter()
     
    11311132private:
    11321133
    1133     AutoLock mLocks [Cnt];
     1134    AutoWriteLock mLocks [Cnt];
    11341135
    11351136    DECLARE_CLS_COPY_CTOR_ASSIGN_NOOP (AutoMultiWriteLockBase)
  • trunk/src/VBox/Main/include/BIOSSettingsImpl.h

    r7207 r8083  
    123123    const Backupable <Data> &data() const { return mData; }
    124124
    125     bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
    126     bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
    127     void rollback() { AutoLock alock (this); mData.rollback(); }
     125    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
     126    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
     127    void rollback() { AutoWriteLock alock (this); mData.rollback(); }
    128128    void commit();
    129129    void copyFrom (BIOSSettings *aThat);
  • trunk/src/VBox/Main/include/DVDDriveImpl.h

    r6076 r8083  
    9595    HRESULT saveSettings (settings::Key &aMachineNode);
    9696
    97     bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
    98     bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
     97    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
     98    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
    9999    bool rollback();
    100100    void commit();
  • trunk/src/VBox/Main/include/FloppyDriveImpl.h

    r6076 r8083  
    9696    HRESULT saveSettings (settings::Key &aMachineNode);
    9797
    98     bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
    99     bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
     98    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
     99    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
    100100    bool rollback();
    101101    void commit();
  • trunk/src/VBox/Main/include/HardDiskImpl.h

    r7992 r8083  
    6666    // protected initializer/uninitializer for internal purposes only
    6767    HRESULT protectedInit (VirtualBox *aVirtualBox, HardDisk *aParent);
    68     void protectedUninit (AutoLock &alock);
     68    void protectedUninit (AutoWriteLock &alock);
    6969
    7070public:
     
    108108    bool isParentImmutable() const
    109109    {
    110         AutoLock parentLock (mParent);
     110        AutoWriteLock parentLock (mParent);
    111111        return !mParent.isNull() && mParent->type() == HardDiskType_Immutable;
    112112    }
     
    121121    /**
    122122     *  Shortcut to #dependentChildren().
    123      *  Do |AutoLock alock (childrenLock());| before acceessing the returned list!
     123     *  Do |AutoWriteLock alock (childrenLock());| before acceessing the returned list!
    124124     */
    125125    const HardDiskList &children() const { return dependentChildren(); }
     
    169169
    170170    /* the following must be called from under the lock */
    171     bool isBusy() { isLockedOnCurrentThread(); return mBusy; }
    172     unsigned readers() { isLockedOnCurrentThread(); return mReaders; }
     171    bool isBusy() { isWriteLockOnCurrentThread(); return mBusy; }
     172    unsigned readers() { isWriteLockOnCurrentThread(); return mReaders; }
    173173    const Bstr &lastAccessError() const { return mLastAccessError; }
    174174
  • trunk/src/VBox/Main/include/MachineImpl.h

    r7992 r8083  
    591591                             bool aSetError = false)
    592592    {
    593         AutoLock alock (this);
     593        AutoWriteLock alock (this);
    594594        return findSharedFolder (aName, aSharedFolder, aSetError);
    595595    }
     
    616616    void uninitDataAndChildObjects();
    617617
    618     void ensureNoStateDependencies (AutoLock &aLock);
     618    void ensureNoStateDependencies (AutoWriteLock &aLock);
    619619
    620620    virtual HRESULT setMachineState (MachineState_T aMachineState);
  • trunk/src/VBox/Main/include/NetworkAdapterImpl.h

    r7207 r8083  
    151151    HRESULT saveSettings (settings::Key &aAdapterNode);
    152152
    153     bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
    154     bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
     153    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
     154    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
    155155    bool rollback();
    156156    void commit();
  • trunk/src/VBox/Main/include/ParallelPortImpl.h

    r6168 r8083  
    9898    HRESULT saveSettings (settings::Key &aPortNode);
    9999
    100     bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
    101     bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
     100    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
     101    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
    102102    bool rollback();
    103103    void commit();
  • trunk/src/VBox/Main/include/ProgressImpl.h

    r5999 r8083  
    5353                  const BSTR aDescription, GUIDPARAMOUT aId = NULL);
    5454    HRESULT protectedInit();
    55     void protectedUninit (AutoLock &alock);
     55    void protectedUninit (AutoWriteLock &alock);
    5656
    5757public:
     
    7676    // public methods only for internal purposes
    7777
    78     Guid id() { AutoLock alock (this); return mId; }
    79     BOOL completed() { AutoLock alock (this); return mCompleted; }
    80     HRESULT resultCode() { AutoLock alock (this); return mResultCode; }
     78    Guid id() { AutoWriteLock alock (this); return mId; }
     79    BOOL completed() { AutoWriteLock alock (this); return mCompleted; }
     80    HRESULT resultCode() { AutoWriteLock alock (this); return mResultCode; }
    8181
    8282    // for VirtualBoxSupportErrorInfoImpl
     
    259259                  GUIDPARAMOUT aId = NULL)
    260260    {
    261         AutoLock lock (this);
     261        AutoWriteLock alock (this);
    262262        ComAssertRet (!isReady(), E_UNEXPECTED);
    263263
     
    283283                  GUIDPARAMOUT aId = NULL)
    284284    {
    285         AutoLock lock (this);
     285        AutoWriteLock alock (this);
    286286        ComAssertRet (!isReady(), E_UNEXPECTED);
    287287
  • trunk/src/VBox/Main/include/SerialPortImpl.h

    r7207 r8083  
    109109    HRESULT saveSettings (settings::Key &aPortNode);
    110110
    111     bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
    112     bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
     111    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
     112    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
    113113    bool rollback();
    114114    void commit();
  • trunk/src/VBox/Main/include/Shareable.h

    r5999 r8083  
    9292 *
    9393 *  This template class is NOT thread-safe. If you need thread safefy, you can
    94  *  specify AutoLock::Lockable as the second argument to the template. In this
    95  *  case, you can explicitly lock instances of the template (using the AutoLock
    96  *  and AutoReaderLock classes) before accessing any of its members, as follows:
     94 *  specify util::Lockable as the second argument to the template. In this
     95 *  case, you can explicitly lock instances of the template (using the
     96 *  AutoWriteLock and AutoReadLock classes) before accessing any of its
     97 *  members, as follows:
    9798 *  <code>
    9899 *      struct Data { ... };
    99  *      Shareable <Data, AutoLock::Lockable> mData;
     100 *      Shareable <Data, util::Lockable> mData;
    100101 *      ...
    101102 *      {
    102103 *          // acquire the lock until the end of the block
    103  *          AutoLock lock (mData);
     104 *          AutoWriteLock alock (mData);
    104105 *          // share with another instance (thatData defined somewhere else)
    105106 *          {
    106  *              AutoReaderLock thatLock (thatData);
     107 *              AutoReadLock thatLock (thatData);
    107108 *              mData = thatData;
    108109 *          }
     
    117118 *  Shareable instance will prevent another one sharing the same data from
    118119 *  accessing it). This can be done in a similar way by deriving the data
    119  *  structure to manage from AutoLock::Lockable and using the #data() method to
     120 *  structure to manage from util::Lockable and using the #data() method to
    120121 *  lock it before accessing:
    121122 *  <code>
    122  *      struct Data : public AutoLock::Lockable { ... };
    123  *      Shareable <Data, AutoLock::Lockable> mData;
     123 *      struct Data : public util::Lockable { ... };
     124 *      Shareable <Data, util::Lockable> mData;
    124125 *      ...
    125126 *      {
    126127 *          // read-only data access
    127  *          AutoReaderLock lock (mData); // protect Shareable members (read-only)
    128  *          AutoReaderLock dataLock (mData.data()); // protect Data members (read-only)
     128 *          AutoReadLock lock (mData); // protect Shareable members (read-only)
     129 *          AutoReadLock dataLock (mData.data()); // protect Data members (read-only)
    129130 *          if (mData->mSomeVield) ...
    130131 *      }
     
    132133 *      {
    133134 *          // data modification
    134  *          AutoReaderLock lock (mData); // protect Shareable members (still read-only)
    135  *          AutoLock dataLock (mData.data()); // protect Data members (exclusive)
     135 *          AutoReadLock lock (mData); // protect Shareable members (still read-only)
     136 *          AutoWriteLock dataLock (mData.data()); // protect Data members (exclusive)
    136137 *          mData->mSomeVield = someValue;
    137138 *      }
     
    284285 *  template are appliable to this class as well. In particular, all new methods
    285286 *  of this template are not implicitly thread-safe, so if you add thread
    286  *  safety using the AutoLock::Lockable class, don't forget to lock the
     287 *  safety using the util::Lockable class, don't forget to lock the
    287288 *  Backupable instance before doing #backup(), #commit() or #rollback().
    288289 *
  • trunk/src/VBox/Main/include/SnapshotImpl.h

    r7992 r8083  
    8989    // public methods only for internal purposes
    9090
    91     /** Do |AutoLock alock (this);| before acceessing the returned data! */
     91    /** Do |AutoWriteLock alock (this);| before acceessing the returned data! */
    9292    const Data &data() const { return mData; }
    9393
     
    101101    /**
    102102     *  Shortcut to #dependentChildren().
    103      *  Do |AutoLock alock (childrenLock());| before acceessing the returned list!
     103     *  Do |AutoWriteLock alock (childrenLock());| before acceessing the returned list!
    104104     */
    105105    const SnapshotList &children() const { return dependentChildren(); }
  • trunk/src/VBox/Main/include/VRDPServerImpl.h

    r6076 r8083  
    101101    HRESULT saveSettings (settings::Key &aMachineNode);
    102102
    103     bool isModified() { AutoLock alock (this); return mData.isBackedUp(); }
    104     bool isReallyModified() { AutoLock alock (this); return mData.hasActualChanges(); }
     103    bool isModified() { AutoWriteLock alock (this); return mData.isBackedUp(); }
     104    bool isReallyModified() { AutoWriteLock alock (this); return mData.hasActualChanges(); }
    105105    bool rollback();
    106106    void commit();
  • trunk/src/VBox/Main/include/VirtualBoxBase.h

    r7992 r8083  
    449449public:
    450450
    451     // AutoLock::Lockable interface
     451    // util::Lockable interface
    452452    virtual RWLockHandle *lockHandle() const;
    453453
     
    16641664        //  child's uninit() from under the children map lock should not produce
    16651665        //  dead-locks any more).
    1666         Assert (!child->isLockedOnCurrentThread());
     1666        Assert (!child->isWriteLockOnCurrentThread());
    16671667        removeDependentChild (ComPtr <IUnknown> (child));
    16681668    }
     
    17981798    {
    17991799        AssertReturnVoid (aChild);
    1800         Assert (!aChild->isLockedOnCurrentThread());
     1800        Assert (!aChild->isWriteLockOnCurrentThread());
    18011801        doRemoveDependentChild (ComPtr <IUnknown> (aChild));
    18021802    }
     
    18751875        AssertReturn (child, (void) 0);
    18761876
    1877         AutoLock alock (mMapLock);
     1877        AutoWriteLock alock (mMapLock);
    18781878        if (mInUninit)
    18791879            return;
     
    18941894        AssertReturn (child, (void) 0);
    18951895
    1896         AutoLock alock (mMapLock);
     1896        AutoWriteLock alock (mMapLock);
    18971897        if (mInUninit)
    18981898            return;
     
    19051905    /**
    19061906     *  Returns an internal lock handle to lock the list of children
    1907      *  returned by #dependentChildren() using AutoLock:
     1907     *  returned by #dependentChildren() using AutoWriteLock:
    19081908     *  <code>
    1909      *      AutoLock alock (dependentChildrenLock());
     1909     *      AutoWriteLock alock (dependentChildrenLock());
    19101910     *  </code>
    19111911     */
     
    19161916     *  @note
    19171917     *      Access the returned list (iterate, get size etc.) only after
    1918      *      doing |AutoLock alock (dependentChildrenLock());|!
     1918     *      doing |AutoWriteLock alock (dependentChildrenLock());|!
    19191919     */
    19201920    const DependentChildren &dependentChildren() const { return mDependentChildren; }
     
    19321932    void uninitDependentChildren()
    19331933    {
    1934         AutoLock alock (this);
    1935         AutoLock mapLock (mMapLock);
     1934        AutoWriteLock alock (this);
     1935        AutoWriteLock mapLock (mMapLock);
    19361936
    19371937        if (mDependentChildren.size())
     
    19691969    void removeDependentChildren()
    19701970    {
    1971         AutoLock alock (mMapLock);
     1971        AutoWriteLock alock (mMapLock);
    19721972        mDependentChildren.clear();
    19731973    }
     
    20292029        AssertReturnVoid (aChild);
    20302030
    2031         AutoLock alock (mMapLock);
     2031        AutoWriteLock alock (mMapLock);
    20322032        if (mInUninit)
    20332033            return;
     
    20492049        AssertReturnVoid (aChild);
    20502050
    2051         AutoLock alock (mMapLock);
     2051        AutoWriteLock alock (mMapLock);
    20522052        if (mInUninit)
    20532053            return;
     
    20602060    /**
    20612061     * Returns an internal lock handle used to lock the list of children
    2062      * returned by #dependentChildren(). This lock is to be used by AutoLock as
    2063      * follows:
     2062     * returned by #dependentChildren(). This lock is to be used by
     2063     * AutoWriteLock as follows:
    20642064     * <code>
    2065      *      AutoLock alock (dependentChildrenLock());
     2065     *      AutoWriteLock alock (dependentChildrenLock());
    20662066     * </code>
    20672067     */
     
    20722072     *
    20732073     * @note Access the returned list (iterate, get size etc.) only after doing
    2074      *       AutoLock alock (dependentChildrenLock())!
     2074     *       AutoWriteLock alock (dependentChildrenLock())!
    20752075     */
    20762076    const DependentChildren &dependentChildren() const { return mDependentChildren; }
     
    20872087    {
    20882088        /// @todo why?..
    2089         AssertReturnVoid (isLockedOnCurrentThread());
    2090 
    2091         AutoLock alock (mMapLock);
     2089        AssertReturnVoid (isWriteLockOnCurrentThread());
     2090
     2091        AutoWriteLock alock (mMapLock);
    20922092        mDependentChildren.clear();
    20932093    }
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