好久没有写了,回来更新一下,但是好像不知道写什么了。

 

QThreadPool

Qt 线程池,好用,需要先用QRunnable建运行任务。线程池启动任务

QT标准示例 

class HelloWorldTask : public QRunnable
{
void run() override
{
qDebug() << "Hello world from thread" << QThread::currentThread();
}
};

HelloWorldTask *hello = new HelloWorldTask();
// QThreadPool takes ownership and deletes 'hello' automatically
QThreadPool::globalInstance()->start(hello);

posted on 2023-07-17 11:24  七星落地  阅读(9)  评论(0)    收藏  举报