我创建了很多从QObject继承的线程。我想把这些线程放到ThreadPool中。我怎样才能实现它?
class MyTask : public QObject
{
Q_OBJECT
public:
explicit MyTask(QObject *parent = 0);
signals:
void prepareFinish();
void printFinish();
public slots:
//thread invoke
void prepareData();
void printData();
private:
static int i;
static QMutex *mutex;
QWaitCondition bufferEmpty;
QWaitCondition bufferFull;
static bool flag;
};
//MyTask is thread invoke task