VirtualBox

Changeset 57664 in vbox for trunk


Ignore:
Timestamp:
Sep 9, 2015 1:10:13 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: Thread-pool: Use the task types to distinguish one kind of tasks from another.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIThreadPool.h

    r57663 r57664  
    9494        /** Holds the queue (FIFO) of pending tasks. */
    9595        QQueue<UITask*> m_tasks;
    96         /** Holds the condition variable that gets signalled when
     96       /** Holds the condition variable that gets signalled when
    9797          * queuing a new task and there are idle worker threads around.
    9898          * @remarks Idle threads sits in dequeueTask waiting for this.
     
    121121public:
    122122
    123     /** Constructs worker-thread task. */
    124     UITask() {}
     123    /** Task types. */
     124    enum Type
     125    {
     126        Type_MediumEnumeration = 1,
     127    };
     128
     129    /** Constructs the task of passed @a type. */
     130    UITask(UITask::Type type) : m_type(type) {}
     131
     132    /** Returns the type of the task. */
     133    UITask::Type type() const { return m_type; }
    125134
    126135    /** Starts the task. */
     
    132141      * @remarks To be reimplemented in sub-class. */
    133142    virtual void run() = 0;
     143
     144private:
     145
     146    /** Holds the type of the task. */
     147    const UITask::Type m_type;
    134148};
    135149
  • trunk/src/VBox/Frontends/VirtualBox/src/medium/UIMediumEnumerator.cpp

    r57663 r57664  
    4747    /** Constructs @a medium enumeration task. */
    4848    UITaskMediumEnumeration(const UIMedium &medium)
     49        : UITask(UITask::Type_MediumEnumeration)
    4950    {
    5051        /* Store medium as property: */
     
    273274{
    274275    /* Make sure that is one of our tasks: */
     276    if (pTask->type() != UITask::Type_MediumEnumeration)
     277        return;
    275278    int iIndexOfTask = m_tasks.indexOf(pTask);
    276279    AssertReturnVoid(iIndexOfTask != -1);
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