如何在qt5

时间:2017-01-23 08:36:44

标签: qt5

我创建了很多从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 

0 个答案:

没有答案