#ifndef INTERACTIVEWORK_H
#define INTERACTIVEWORK_H

#include <QThread>
#include <QMutex>
#include <QMutexLocker>
#include <QThreadPool>

#include "InteractiveTask.h"
#include "template_singleton.h"

class InteractiveWork : public QThread
{
    SINGLETON_DEFINE(InteractiveWork)
    Q_OBJECT
private:
    explicit InteractiveWork(QObject *parent = nullptr);
    ~InteractiveWork();
public:
    void appendTask(InteractiveTask *task);

protected:
    void run();

signals:
    void signal_completed(InteractiveTask *task);
    void signal_failstart(InteractiveTask *task);

private:
    bool m_bThread;
    QMutex m_mutex;
    QList<InteractiveTask *> m_listTask;
};

#endif // INTERACTIVEWORK_H
