VirtualBox

Changeset 21686 in vbox for trunk/src/VBox/Main/HostImpl.cpp


Ignore:
Timestamp:
Jul 17, 2009 1:41:39 PM (16 years ago)
Author:
vboxsync
Message:

Main: back out r50147 until the locking is properly understood; will come back.

File:
1 edited

Legend:

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

    r21622 r21686  
    152152void Host::FinalRelease()
    153153{
    154     uninit();
     154    if (isReady())
     155        uninit();
    155156}
    156157
     
    163164 * @param aParent   VirtualBox parent object.
    164165 */
    165 HRESULT Host::init(VirtualBox *aParent)
    166 {
    167     LogFlowThisFunc (("aParent=%p\n", aParent));
    168 
    169     /* Enclose the state transition NotReady->InInit->Ready */
    170     AutoInitSpan autoInitSpan (this);
    171     AssertReturn (autoInitSpan.isOk(), E_FAIL);
     166HRESULT Host::init (VirtualBox *aParent)
     167{
     168    LogFlowThisFunc (("isReady=%d\n", isReady()));
     169
     170    ComAssertRet (aParent, E_INVALIDARG);
     171
     172    AutoWriteLock alock (this);
     173    ComAssertRet (!isReady(), E_FAIL);
    172174
    173175    mParent = aParent;
     
    258260#endif /* VBOX_WITH_CROGL */
    259261
    260     /* Confirm a successful initialization */
    261     autoInitSpan.setSucceeded();
    262 
     262    setReady(true);
    263263    return S_OK;
    264264}
     
    270270void Host::uninit()
    271271{
    272     LogFlowThisFunc (("\n"));
    273 
    274     /* Enclose the state transition Ready->InUninit->NotReady */
    275     AutoUninitSpan autoUninitSpan (this);
    276     if (autoUninitSpan.uninitDone())
    277         return;
     272    LogFlowThisFunc (("isReady=%d\n", isReady()));
     273
     274    AssertReturn (isReady(), (void) 0);
    278275
    279276#ifdef VBOX_WITH_RESOURCE_USAGE_API
     
    298295    mUSBDeviceFilters.clear();
    299296#endif
     297
     298    setReady (FALSE);
    300299}
    301300
     
    312311{
    313312    CheckComArgOutSafeArrayPointerValid(aDrives);
    314 
    315     AutoCaller autoCaller (this);
    316     CheckComRCReturnRC (autoCaller.rc());
    317 
    318     AutoWriteLock alock (this);
    319 
    320     std::list< ComObjPtr<HostDVDDrive> > list;
     313    AutoWriteLock alock (this);
     314    CHECK_READY();
     315    std::list <ComObjPtr <HostDVDDrive> > list;
    321316    HRESULT rc = S_OK;
    322317    try
     
    444439{
    445440    CheckComArgOutPointerValid(aDrives);
    446 
    447     AutoCaller autoCaller(this);
    448     CheckComRCReturnRC(autoCaller.rc());
    449 
    450     AutoWriteLock alock(this);
    451 
    452     std::list<ComObjPtr <HostFloppyDrive> > list;
     441    AutoWriteLock alock (this);
     442    CHECK_READY();
     443
     444    std::list <ComObjPtr <HostFloppyDrive> > list;
    453445    HRESULT rc = S_OK;
    454446
     
    562554        return E_POINTER;
    563555
    564     AutoCaller autoCaller (this);
    565     CheckComRCReturnRC (autoCaller.rc());
    566 
    567     AutoWriteLock alock (this);
     556    AutoWriteLock alock (this);
     557    CHECK_READY();
    568558
    569559    std::list <ComObjPtr <HostNetworkInterface> > list;
     
    843833    CheckComArgOutSafeArrayPointerValid(aUSBDevices);
    844834
    845     AutoCaller autoCaller (this);
    846     CheckComRCReturnRC (autoCaller.rc());
    847 
    848     AutoWriteLock alock (this);
     835    AutoWriteLock alock (this);
     836    CHECK_READY();
    849837
    850838    MultiResult rc = checkUSBProxyService();
     
    870858    CheckComArgOutSafeArrayPointerValid(aUSBDeviceFilters);
    871859
    872     AutoCaller autoCaller (this);
    873     CheckComRCReturnRC (autoCaller.rc());
    874 
    875     AutoWriteLock alock (this);
     860    AutoWriteLock alock (this);
     861    CHECK_READY();
    876862
    877863    MultiResult rc = checkUSBProxyService();
     
    903889{
    904890    CheckComArgOutPointerValid(aCount);
    905 //     AutoCaller autoCaller (this);
    906 //     CheckComRCReturnRC (autoCaller.rc());
    907 
    908 //     AutoReadLock alock (this);
    909 
     891    AutoWriteLock alock (this);
     892    CHECK_READY();
    910893    *aCount = RTMpGetPresentCount();
    911894    return S_OK;
     
    921904{
    922905    CheckComArgOutPointerValid(aCount);
    923 //     AutoCaller autoCaller (this);
    924 //     CheckComRCReturnRC (autoCaller.rc());
    925 
    926 //     AutoReadLock alock (this);
    927 
     906    AutoWriteLock alock (this);
     907    CHECK_READY();
    928908    *aCount = RTMpGetOnlineCount();
    929909    return S_OK;
     
    940920{
    941921    CheckComArgOutPointerValid(aSpeed);
    942 //     AutoCaller autoCaller (this);
    943 //     CheckComRCReturnRC (autoCaller.rc());
    944 
    945 //     AutoReadLock alock (this);
    946 
     922    AutoWriteLock alock (this);
     923    CHECK_READY();
    947924    *aSpeed = RTMpGetMaxFrequency(aCpuId);
    948925    return S_OK;
     
    958935{
    959936    CheckComArgOutPointerValid(aDescription);
    960 //     AutoCaller autoCaller (this);
    961 //     CheckComRCReturnRC (autoCaller.rc());
    962 
    963 //     AutoReadLock alock (this);
    964 
     937    AutoWriteLock alock (this);
     938    CHECK_READY();
    965939    /** @todo */
    966940    ReturnComNotImplemented();
     
    977951{
    978952    CheckComArgOutPointerValid(aSupported);
    979     AutoCaller autoCaller (this);
    980     CheckComRCReturnRC (autoCaller.rc());
    981 
    982     AutoReadLock alock (this);
     953    AutoWriteLock alock (this);
     954    CHECK_READY();
    983955
    984956    switch (aFeature)
     
    1011983{
    1012984    CheckComArgOutPointerValid(aSize);
    1013     AutoCaller autoCaller (this);
    1014     CheckComRCReturnRC (autoCaller.rc());
    1015 
    1016     AutoWriteLock alock (this);
    1017 
     985    AutoWriteLock alock (this);
     986    CHECK_READY();
    1018987    /* @todo This is an ugly hack. There must be a function in IPRT for that. */
    1019988    pm::CollectorHAL *hal = pm::createHAL();
     
    10361005{
    10371006    CheckComArgOutPointerValid(aAvailable);
    1038     AutoCaller autoCaller (this);
    1039     CheckComRCReturnRC (autoCaller.rc());
    1040 
    1041     AutoWriteLock alock (this);
    1042 
     1007    AutoWriteLock alock (this);
     1008    CHECK_READY();
    10431009    /* @todo This is an ugly hack. There must be a function in IPRT for that. */
    10441010    pm::CollectorHAL *hal = pm::createHAL();
     
    10611027{
    10621028    CheckComArgOutPointerValid(aOs);
    1063 //     AutoCaller autoCaller (this);
    1064 //     CheckComRCReturnRC (autoCaller.rc());
    1065 
    1066 //     AutoReadLock alock (this);
     1029    AutoWriteLock alock (this);
     1030    CHECK_READY();
    10671031
    10681032    char szOSName[80];
     
    10831047{
    10841048    CheckComArgOutPointerValid(aVersion);
    1085 //     AutoCaller autoCaller (this);
    1086 //     CheckComRCReturnRC (autoCaller.rc());
    1087 
    1088 //     AutoReadLock alock (this);
     1049    AutoWriteLock alock (this);
     1050    CHECK_READY();
    10891051
    10901052    /* Get the OS release. Reserve some buffer space for the service pack. */
     
    11221084{
    11231085    CheckComArgOutPointerValid(aUTCTime);
    1124 //     AutoCaller autoCaller (this);
    1125 //     CheckComRCReturnRC (autoCaller.rc());
    1126 
    1127 //     AutoReadLock alock (this);
    1128 
     1086    AutoWriteLock alock (this);
     1087    CHECK_READY();
    11291088    RTTIMESPEC now;
    11301089    *aUTCTime = RTTimeSpecGetMilli(RTTimeNow(&now));
    1131 
    11321090    return S_OK;
    11331091}
     
    11361094{
    11371095    CheckComArgOutPointerValid(aSupported);
    1138     AutoCaller autoCaller (this);
    1139     CheckComRCReturnRC (autoCaller.rc());
    1140 
    1141     AutoReadLock alock (this);
     1096
     1097    AutoWriteLock alock(this);
     1098    CHECK_READY();
    11421099
    11431100    *aSupported = f3DAccelerationSupported;
     
    11551112    CheckComArgOutPointerValid(aProgress);
    11561113
    1157     AutoCaller autoCaller (this);
    1158     CheckComRCReturnRC (autoCaller.rc());
    1159 
    1160     AutoWriteLock alock (this);
     1114    AutoWriteLock alock (this);
     1115    CHECK_READY();
    11611116
    11621117    int r = NetIfCreateHostOnlyNetworkInterface (mParent, aHostNetworkInterface, aProgress);
     
    11771132    CheckComArgOutPointerValid(aProgress);
    11781133
    1179     AutoCaller autoCaller (this);
    1180     CheckComRCReturnRC (autoCaller.rc());
    1181 
    1182     AutoWriteLock alock (this);
     1134    AutoWriteLock alock (this);
     1135    CHECK_READY();
    11831136
    11841137    /* first check whether an interface with the given name already exists */
     
    12061159    CheckComArgOutPointerValid(aFilter);
    12071160
    1208     AutoCaller autoCaller (this);
    1209     CheckComRCReturnRC (autoCaller.rc());
    1210 
    1211     AutoWriteLock alock (this);
     1161    AutoWriteLock alock (this);
     1162    CHECK_READY();
    12121163
    12131164    ComObjPtr <HostUSBDeviceFilter> filter;
     
    12341185
    12351186    /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */
    1236     AutoCaller autoCaller (this);
    1237     CheckComRCReturnRC (autoCaller.rc());
    1238 
    1239     AutoWriteLock alock (this);
     1187    AutoWriteLock alock (this);
     1188    CHECK_READY();
    12401189
    12411190    MultiResult rc = checkUSBProxyService();
     
    12851234
    12861235    /* Note: HostUSBDeviceFilter and USBProxyService also uses this lock. */
    1287     AutoCaller autoCaller (this);
    1288     CheckComRCReturnRC (autoCaller.rc());
    1289 
    1290     AutoWriteLock alock (this);
     1236    AutoWriteLock alock (this);
     1237    CHECK_READY();
    12911238
    12921239    MultiResult rc = checkUSBProxyService();
     
    13441291    using namespace settings;
    13451292
    1346     AutoCaller autoCaller (this);
    1347     CheckComRCReturnRC (autoCaller.rc());
    1348 
    1349     AutoWriteLock alock (this);
     1293    AutoWriteLock alock (this);
     1294    CHECK_READY();
    13501295
    13511296    AssertReturn (!aGlobal.isNull(), E_FAIL);
     
    14081353    using namespace settings;
    14091354
    1410     AutoCaller autoCaller (this);
    1411     CheckComRCReturnRC (autoCaller.rc());
    1412 
    1413     AutoWriteLock alock (this);
     1355    AutoWriteLock alock (this);
     1356    CHECK_READY();
    14141357
    14151358    ComAssertRet (!aGlobal.isNull(), E_FAIL);
     
    14881431                                       BOOL aActiveChanged /* = FALSE */)
    14891432{
    1490     AutoCaller autoCaller (this);
    1491     CheckComRCReturnRC (autoCaller.rc());
    1492 
    1493     AutoWriteLock alock (this);
     1433    AutoWriteLock alock (this);
     1434    CHECK_READY();
    14941435
    14951436    if (aFilter->mInList)
     
    20682009HRESULT Host::checkUSBProxyService()
    20692010{
    2070     AutoCaller autoCaller (this);
    2071     CheckComRCReturnRC (autoCaller.rc());
    2072 
    2073     AutoWriteLock alock (this);
     2011    AutoWriteLock alock (this);
     2012    CHECK_READY();
    20742013
    20752014    AssertReturn (mUSBProxyService, E_FAIL);
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