VirtualBox

Changeset 30882 in vbox


Ignore:
Timestamp:
Jul 16, 2010 3:20:43 PM (14 years ago)
Author:
vboxsync
Message:

Main/Machine+VirtualBox: add missing synchronization to the delayed unregistration of VM metrics, and make it bullet proof.

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

Legend:

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

    r30847 r30882  
    91719171void Machine::registerMetrics(PerformanceCollector *aCollector, Machine *aMachine, RTPROCESS pid)
    91729172{
     9173    AssertReturnVoid(isWriteLockOnCurrentThread());
     9174    AssertPtrReturnVoid(aCollector);
     9175
    91739176    pm::CollectorHAL *hal = aCollector->getHAL();
    91749177    /* Create sub metrics */
     
    92879290void Machine::unregisterMetrics(PerformanceCollector *aCollector, Machine *aMachine)
    92889291{
    9289     aCollector->unregisterMetricsFor(aMachine);
    9290     aCollector->unregisterBaseMetricsFor(aMachine);
     9292    AssertReturnVoid(isWriteLockOnCurrentThread());
     9293
     9294    if (aCollector)
     9295    {
     9296        aCollector->unregisterMetricsFor(aMachine);
     9297        aCollector->unregisterBaseMetricsFor(aMachine);
     9298    }
    92919299
    92929300    if (mGuestHAL)
     9301    {
    92939302        delete mGuestHAL;
     9303        mGuestHAL = NULL;
     9304    }
    92949305}
    92959306
  • trunk/src/VBox/Main/VirtualBoxImpl.cpp

    r30881 r30882  
    27232723         * it done immediately. It reduces the number of locks needed and
    27242724         * the lock contention in SessionMachine::uninit. */
    2725         mMachine->unregisterMetrics(mVirtualBox->performanceCollector(), mMachine);
     2725        {
     2726            AutoWriteLock mLock(mMachine COMMA_LOCKVAL_SRC_POS);
     2727            mMachine->unregisterMetrics(mVirtualBox->performanceCollector(), mMachine);
     2728        }
    27262729#endif /* VBOX_WITH_RESOURCE_USAGE_API */
    27272730
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