VirtualBox

Changeset 20885 in vbox for trunk


Ignore:
Timestamp:
Jun 24, 2009 11:04:15 AM (16 years ago)
Author:
vboxsync
Message:

Main: Fix dead lock when mounting/umounting DVDs/Floppies if the guest uses SMP.

File:
1 edited

Legend:

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

    r20729 r20885  
    28772877    AssertComRCReturn (autoCaller.rc(), VERR_ACCESS_DENIED);
    28782878
    2879     /*
    2880      * Locking the object before doing VMR3* calls is quite safe here, since
    2881      * we're on EMT. Write lock is necessary because we indirectly modify the
    2882      * meDVDState/meFloppyState members (pointed to by peState).
    2883      */
    2884     AutoWriteLock alock (pThis);
    2885 
    28862879    /* protect mpVM */
    28872880    AutoVMCaller autoVMCaller (pThis);
     
    29252918    int rc = VINF_SUCCESS;
    29262919    int rcRet = VINF_SUCCESS;
     2920
     2921    /*
     2922       In general locking the object before doing VMR3* calls is quite safe
     2923       here, since we're on EMT. Anyway we lock for write after eventually
     2924       suspending the vm. The reason is that in the vmstateChangeCallback the
     2925       var mVMStateChangeCallbackDisabled is checked under a lock also, which
     2926       can lead to an dead lock. The write lock is necessary because we
     2927       indirectly modify the meDVDState/meFloppyState members (pointed to by
     2928       peState).
     2929     */
     2930    AutoWriteLock alock (pThis);
    29272931
    29282932    do
     
    31283132    }
    31293133    while (0);
     3134
     3135    /*
     3136       Unlock before resuming because the vmstateChangeCallback problem
     3137       described above.
     3138     */
     3139    alock.unlock();
    31303140
    31313141    /*
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