VirtualBox

Changeset 57611 in vbox for trunk


Ignore:
Timestamp:
Sep 3, 2015 2:38:36 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Thread-pool: Move medium-enumeration's thread-pool object to VBoxGlobal scope to be used by other parties.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.cpp

    r57591 r57611  
    5959# include "QIDialogButtonBox.h"
    6060# include "UIIconPool.h"
     61# include "UIThreadPool.h"
    6162# include "UIShortcutPool.h"
    6263# include "UIExtraDataManager.h"
     
    255256    , mSettingsPwSet(false)
    256257    , m_pIconPool(0)
     258    , m_pThreadPool(0)
    257259{
    258260    /* Assign instance: */
     
    40584060            this, SLOT(sltHandleVBoxSVCAvailabilityChange(bool)));
    40594061
     4062    /* Prepare thread-pool instance: */
     4063    m_pThreadPool = new UIThreadPool(3 /* worker count */, 5000 /* worker timeout */);
     4064
    40604065    /* create default non-null global settings */
    40614066    gset = VBoxGlobalSettings (false);
     
    44524457    UIConverter::cleanup();
    44534458
     4459    /* Cleanup thread-pool: */
     4460    delete m_pThreadPool;
     4461    m_pThreadPool = 0;
    44544462    /* Cleanup general icon-pool: */
    44554463    delete m_pIconPool;
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r57590 r57611  
    6565class UIMedium;
    6666class UIIconPoolGeneral;
     67class UIThreadPool;
    6768#ifdef Q_WS_X11
    6869class UIDesktopWidgetWatchdog;
     
    139140    /** Returns the VBoxSVC availability value. */
    140141    bool isVBoxSVCAvailable() const { return m_fVBoxSVCAvailable; }
     142
     143    /** Returns the thread-pool instance. */
     144    UIThreadPool* threadPool() const { return m_pThreadPool; }
    141145
    142146    /** @name Host-screen geometry stuff
     
    638642    /** General icon-pool. */
    639643    UIIconPoolGeneral *m_pIconPool;
     644    /** Holds the thread-pool instance. */
     645    UIThreadPool *m_pThreadPool;
    640646
    641647    /* API: Instance stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r56125 r57611  
    6969
    7070
    71 UIMediumEnumerator::UIMediumEnumerator(ulong uWorkerCount /* = 3*/, ulong uWorkerTimeout /* = 5000*/)
    72     : m_pThreadPool(0)
    73     , m_fMediumEnumerationInProgress(false)
     71UIMediumEnumerator::UIMediumEnumerator()
     72    : m_fMediumEnumerationInProgress(false)
    7473{
    7574    /* Allow UIMedium to be used in inter-thread signals: */
     
    8483    connect(gVBoxEvents, SIGNAL(sigMachineRegistered(QString, bool)), this, SLOT(sltHandleMachineRegistration(QString, bool)));
    8584
    86     /* Prepare thread-pool: */
    87     m_pThreadPool = new UIThreadPool(uWorkerCount, uWorkerTimeout);
    88     connect(m_pThreadPool, SIGNAL(sigTaskComplete(UITask*)), this, SLOT(sltHandleMediumEnumerationTaskComplete(UITask*)));
     85    /* Listen for global thread-pool: */
     86    connect(vboxGlobal().threadPool(), SIGNAL(sigTaskComplete(UITask*)), this, SLOT(sltHandleMediumEnumerationTaskComplete(UITask*)));
    8987}
    9088
    9189UIMediumEnumerator::~UIMediumEnumerator()
    9290{
    93     /* Delete thread-pool: */
    94     delete m_pThreadPool;
    95     m_pThreadPool = 0;
    96 
    9791    /* Delete all the tasks: */
    9892    while (!m_tasks.isEmpty())
     
    348342    /* Append to internal list: */
    349343    m_tasks.append(pTask);
    350     /* Post into thread-pool: */
    351     m_pThreadPool->enqueueTask(pTask);
     344    /* Post into global thread-pool: */
     345    vboxGlobal().threadPool()->enqueueTask(pTask);
    352346}
    353347
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.h

    r55401 r57611  
    5151public:
    5252
    53     /* Constructor/destructor: */
    54     UIMediumEnumerator(ulong uWorkerCount = 3, ulong uWorkerTimeout = 5000);
     53    /** Constructs medium-enumerator object. */
     54    UIMediumEnumerator();
     55    /** Destructs medium-enumerator object. */
    5556    ~UIMediumEnumerator();
    5657
     
    9495
    9596    /* Variables: */
    96     UIThreadPool *m_pThreadPool;
    9797    bool m_fMediumEnumerationInProgress;
    9898    QList<UITask*> m_tasks;
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