QT线程同步

 

 

// 1线程同步
QFutureSynchronizer<void> synchronizer;

 //2线程1

synchronizer.addFuture(QtConcurrent::run([=]() {
download(url);
}));

 //3线程2

synchronizer.addFuture(QtConcurrent::run([=]() {
download(webpicurl);
}));

//4等待下载完成

 synchronizer.waitForFinished();

//5ToSomeThing

 

二、qfuture和qfuturewatch

posted @ 2021-01-29 16:00  秋雨声  阅读(307)  评论(0编辑  收藏  举报