VirtualBox

Changeset 30377 in vbox


Ignore:
Timestamp:
Jun 22, 2010 2:01:01 PM (15 years ago)
Author:
vboxsync
Message:

Main: do not hold any other lock while calling VirtualBox::saveSettings (mostly comments, only real change is in DHCPServer); also, VirtualBox lock is not needed in SessionMachine::endSavingState

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

Legend:

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

    r28800 r30377  
    150150    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    151151
    152     /* VirtualBox::saveSettings() needs a write lock */
    153     AutoMultiWriteLock2 alock(mVirtualBox, this COMMA_LOCKVAL_SRC_POS);
    154 
     152    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    155153    m.enabled = aEnabled;
    156154
     155    // save the global settings; for that we should hold only the VirtualBox lock
     156    alock.release();
     157    AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
    157158    HRESULT rc = mVirtualBox->saveSettings();
    158159
     
    218219    if (FAILED(autoCaller.rc())) return autoCaller.rc();
    219220
    220     /* VirtualBox::saveSettings() needs a write lock */
    221     AutoMultiWriteLock2 alock(mVirtualBox, this COMMA_LOCKVAL_SRC_POS);
    222 
     221    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    223222    m.IPAddress = aIPAddress;
    224223    m.networkMask = aNetworkMask;
     
    226225    m.upperIP = aUpperIP;
    227226
     227    // save the global settings; for that we should hold only the VirtualBox lock
     228    alock.release();
     229    AutoWriteLock vboxLock(mVirtualBox COMMA_LOCKVAL_SRC_POS);
    228230    return mVirtualBox->saveSettings();
    229231}
  • trunk/src/VBox/Main/HostImpl.cpp

    r30304 r30377  
    11431143    }
    11441144
    1145     /* save the global settings */
     1145    // save the global settings; for that we should hold only the VirtualBox lock
    11461146    alock.release();
    11471147    AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS);
     
    11991199    }
    12001200
    1201     /* save the global settings */
     1201    // save the global settings; for that we should hold only the VirtualBox lock
    12021202    alock.release();
    12031203    AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS);
     
    17641764
    17651765        // save the global settings... yeah, on every single filter property change
     1766        // for that we should hold only the VirtualBox lock
    17661767        alock.release();
    17671768        AutoWriteLock vboxLock(m->pParent COMMA_LOCKVAL_SRC_POS);
  • trunk/src/VBox/Main/MachineImpl.cpp

    r30305 r30377  
    31633163    if (fNeedsSaveSettings)
    31643164    {
     3165        // save the global settings; for that we should hold only the VirtualBox lock
    31653166        mediumLock.release();
    31663167        treeLock.leave();
     
    32573258        if (fNeedsGlobalSaveSettings)
    32583259        {
     3260            // save the global settings; for that we should hold only the VirtualBox lock
    32593261            alock.release();
    32603262            AutoWriteLock vboxlock(this COMMA_LOCKVAL_SRC_POS);
     
    36563658        if (fNeedsGlobalSaveSettings)
    36573659        {
     3660            // save the global settings; for that we should hold only the VirtualBox lock
    36583661            alock.release();
    36593662            AutoWriteLock vboxlock(mParent COMMA_LOCKVAL_SRC_POS);
     
    36913694    if (SUCCEEDED(rc) && fNeedsGlobalSaveSettings)
    36923695    {
     3696        // save the global settings; for that we should hold only the VirtualBox lock
    36933697        AutoWriteLock vlock(mParent COMMA_LOCKVAL_SRC_POS);
    36943698        rc = mParent->saveSettings();
     
    1079910803    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    1080010804
    10801     /* saveSettings() needs mParent lock */
    10802     AutoMultiWriteLock2 alock(mParent, this COMMA_LOCKVAL_SRC_POS);
     10805    AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    1080310806
    1080410807    HRESULT rc = S_OK;
  • trunk/src/VBox/Main/MediumImpl.cpp

    r30314 r30377  
    14431443    m->type = aType;
    14441444
     1445    // save the global settings; for that we should hold only the VirtualBox lock
    14451446    mlock.release();
    1446 
    1447     // saveSettings needs vbox lock
    14481447    AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    1449 
    14501448    HRESULT rc = m->pVirtualBox->saveSettings();
    14511449
     
    15721570        m->autoReset = !!aAutoReset;
    15731571
     1572        // save the global settings; for that we should hold only the VirtualBox lock
    15741573        mlock.release();
    1575 
    1576         // saveSettings needs vbox lock
    15771574        AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    1578 
    15791575        return m->pVirtualBox->saveSettings();
    15801576    }
     
    20142010        it->second = aValue;
    20152011
     2012    // save the global settings; for that we should hold only the VirtualBox lock
    20162013    mlock.release();
    2017 
    2018     // saveSettings needs vbox lock
    20192014    AutoWriteLock alock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    20202015    HRESULT rc = m->pVirtualBox->saveSettings();
     
    21792174
    21802175    bool fNeedsSaveSettings = false;
    2181     ComObjPtr <Progress> pProgress;
     2176    ComObjPtr<Progress> pProgress;
    21822177
    21832178    HRESULT rc = deleteStorage(&pProgress,
     
    52105205                               task.mVDOperationIfaces);
    52115206            if (RT_FAILURE(vrc))
    5212             {
    52135207                throw setError(E_FAIL,
    52145208                            tr("Could not create the hard disk storage unit '%s'%s"),
    52155209                            location.raw(), vdError(vrc).raw());
    5216             }
    52175210
    52185211            size = VDGetFileSize(hdd, 0);
     
    54415434        if (fNeedsSaveSettings)
    54425435        {
     5436            // save the global settings; for that we should hold only the VirtualBox lock
    54435437            mediaLock.release();
    54445438            AutoWriteLock vboxlock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
     
    57275721    {
    57285722        // in asynchronous mode, save settings now
     5723        // for that we should hold only the VirtualBox lock
    57295724        AutoWriteLock vboxlock(m->pVirtualBox COMMA_LOCKVAL_SRC_POS);
    57305725        m->pVirtualBox->saveSettings();
  • trunk/src/VBox/Main/SnapshotImpl.cpp

    r29540 r30377  
    15301530    mSnapshotData.mSnapshot.setNull();
    15311531
    1532     // save VirtualBox.xml (media registry most probably changed with diff image)
     1532    // save VirtualBox.xml (media registry most probably changed with diff image);
     1533    // for that we should hold only the VirtualBox lock
    15331534    machineLock.release();
    15341535    AutoWriteLock vboxLock(mParent COMMA_LOCKVAL_SRC_POS);
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r30358 r30377  
    35313531 *  places internally when settings need saving.
    35323532 *
    3533  *  @note Caller must have locked the VirtualBox object for writing!
     3533 *  @note Caller must have locked the VirtualBox object for writing and must not hold any
     3534 *    other locks since this locks all kinds of member objects and trees temporarily,
     3535 *    which could cause conflicts.
    35343536 */
    35353537HRESULT VirtualBox::saveSettings()
     
    47924794    rc = FindDHCPServerByNetworkName(name, existing.asOutParam());
    47934795    if (SUCCEEDED(rc))
    4794     {
    47954796        return E_INVALIDARG;
    4796     }
    47974797
    47984798    rc = S_OK;
     
    48364836    AssertComRCReturn(autoCaller.rc(), autoCaller.rc());
    48374837
    4838     AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS);
    4839 
    48404838    AutoCaller dhcpServerCaller(aDHCPServer);
    48414839    AssertComRCReturn(dhcpServerCaller.rc(), dhcpServerCaller.rc());
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