当前位置: 首页 > news >正文

怎么自己做歌曲网站深圳搜索引擎优化seo

怎么自己做歌曲网站,深圳搜索引擎优化seo,江苏seo网站排名优化,网络策划是什么1.简介 QThreadPool类管理一个QThread集合。 QThreadPool管理和重新设计单个QThread对象,以帮助降低使用线程的程序中的线程创建成本。每个Qt应用程序都有一个全局QThreadPool对象,可以通过调用globalInstance来访问该对象。 要使用其中一个QThreadPool…

1.简介

QThreadPool类管理一个QThread集合。
QThreadPool管理和重新设计单个QThread对象,以帮助降低使用线程的程序中的线程创建成本。每个Qt应用程序都有一个全局QThreadPool对象,可以通过调用globalInstance来访问该对象。
要使用其中一个QThreadPool线程,请子类化QRunnable并实现run虚拟函数。然后创建该类的一个对象,并将其传递给QThreadPool::start。

主要特点:

  • 线程复用:线程池中的线程可以重复使用,减少了线程创建和销毁的开销。
  • 资源管理:线程池可以帮助管理线程的生命周期,包括线程的创建、销毁和线程数的控制。
  • 任务队列:线程池通常与一个任务队列一起使用,允许你将任务添加到队列中,由线程池中的线程执行。

2.常用方法

  • globalInstance(): 获取全局的 QThreadPool实例。
  • maxThreadCount(): 获取线程池中最大线程数。
  • setMaxThreadCount(int): 设置线程池中最大线程数。
  • activeThreadCount(): 获取当前活跃的线程数。
  • expiryTimeout(): 获取线程的最长存活时间。
  • setExpiryTimeout(int): 设置线程的最长存活时间。
  • start(QRunnable *): 将一个 QRunnable 对象添加到线程池的任务队列中,并在线程池中的一个线程上执行它。
  • tryStart(QRunnable *): 尝试立即在一个空闲线程上执行 QRunnable 对象,如果失败则返回 false
  • waitForDone(int): 阻塞调用线程,直到所有任务执行完毕或超时。
  • clear(): 清空任务队列,停止所有正在执行的任务。
  • releaseThread(): 通知线程池当前线程已经完成了一个任务,可以重新被使用。

3.示例

我们创建了一个简单的 QRunnable 子类 MyRunnable,并在主函数中使用了 QThreadPool 来执行 4 个任务。我们设置了线程池的最大线程数为 4,这意味着同时最多有 4 个线程在执行任务。其他的任务会在线程池中的线程变为可用时被执行。

#include "widget.h"
#include "ui_widget.h"
#include <QRunnable>
#include <QThreadPool>
#include <QDebug>
#include <QMutex>
#include <QList>QList<int> g_list;
QMutex g_mutex;class MyRunnable : public QRunnable
{
public:void run() override{while(true){g_mutex.lock();if(g_list.size() == 0){g_mutex.unlock();break;}qDebug() << "Task running in thread:" << QThread::currentThread() << "deal num "<<g_list.first();g_list.pop_front();g_mutex.unlock();}qDebug() << "Task running in thread:" << QThread::currentThread() << "finished ";}
};Widget::Widget(QWidget *parent) :QWidget(parent),ui(new Ui::Widget)
{ui->setupUi(this);for(int i=0;i<20;i++){g_list.append(i);}QThreadPool::globalInstance()->setMaxThreadCount(4);for (int i = 0; i < 4; ++i){MyRunnable *r = new MyRunnable();r->setAutoDelete(true);QThreadPool::globalInstance()->start(r);}
}Widget::~Widget()
{delete ui;
}

运行结果:

4.更多推荐

libVLC 专栏介绍-CSDN博客

Qt+FFmpeg+opengl从零制作视频播放器-1.项目介绍_qt opengl视频播放器-CSDN博客

QCharts -1.概述-CSDN博客


文章转载自:
http://dinncomadrepore.ssfq.cn
http://dinnconegligent.ssfq.cn
http://dinncohistorian.ssfq.cn
http://dinncocmyk.ssfq.cn
http://dinncolarksome.ssfq.cn
http://dinncoamersfoort.ssfq.cn
http://dinncohillbilly.ssfq.cn
http://dinncoeleventhly.ssfq.cn
http://dinncocyberholic.ssfq.cn
http://dinncoraftsman.ssfq.cn
http://dinncocluw.ssfq.cn
http://dinncovoder.ssfq.cn
http://dinncokerman.ssfq.cn
http://dinncoquantise.ssfq.cn
http://dinncoautarky.ssfq.cn
http://dinncoshweli.ssfq.cn
http://dinncoeternally.ssfq.cn
http://dinncoarchdeaconship.ssfq.cn
http://dinncoexpressionistic.ssfq.cn
http://dinncocreationary.ssfq.cn
http://dinncomonosabio.ssfq.cn
http://dinnconovember.ssfq.cn
http://dinncosuperordinary.ssfq.cn
http://dinncotopos.ssfq.cn
http://dinncophonematic.ssfq.cn
http://dinncoscreed.ssfq.cn
http://dinncodashaveyor.ssfq.cn
http://dinncocaptainless.ssfq.cn
http://dinncosequentially.ssfq.cn
http://dinncodishonestly.ssfq.cn
http://dinncoliffey.ssfq.cn
http://dinncomorat.ssfq.cn
http://dinncosmeech.ssfq.cn
http://dinncosocotra.ssfq.cn
http://dinncotanalized.ssfq.cn
http://dinncoconsubstantial.ssfq.cn
http://dinncopredilection.ssfq.cn
http://dinncohurds.ssfq.cn
http://dinncoparageusia.ssfq.cn
http://dinncolanguishment.ssfq.cn
http://dinncosnapshoot.ssfq.cn
http://dinncoensoul.ssfq.cn
http://dinncomegacephaly.ssfq.cn
http://dinncofollies.ssfq.cn
http://dinncostrapwork.ssfq.cn
http://dinncocoffinite.ssfq.cn
http://dinncosingulative.ssfq.cn
http://dinncowirephoto.ssfq.cn
http://dinncoatavism.ssfq.cn
http://dinncocollagenolytic.ssfq.cn
http://dinnconaughtily.ssfq.cn
http://dinncosicky.ssfq.cn
http://dinncoapplewood.ssfq.cn
http://dinncocapacious.ssfq.cn
http://dinncocryology.ssfq.cn
http://dinncopardi.ssfq.cn
http://dinncorectilineal.ssfq.cn
http://dinncosyntechnic.ssfq.cn
http://dinncouncannily.ssfq.cn
http://dinncoossetia.ssfq.cn
http://dinncocarnarvon.ssfq.cn
http://dinncomythical.ssfq.cn
http://dinncocavil.ssfq.cn
http://dinncoforevermore.ssfq.cn
http://dinncodimerization.ssfq.cn
http://dinncojapanophobe.ssfq.cn
http://dinncoshillaber.ssfq.cn
http://dinncokinesiatrics.ssfq.cn
http://dinncodemission.ssfq.cn
http://dinncosciolistic.ssfq.cn
http://dinncosubobsolete.ssfq.cn
http://dinncoironic.ssfq.cn
http://dinncocambistry.ssfq.cn
http://dinncofridge.ssfq.cn
http://dinncopartyism.ssfq.cn
http://dinncohypergalactia.ssfq.cn
http://dinncosizing.ssfq.cn
http://dinncodisparager.ssfq.cn
http://dinncotheodicy.ssfq.cn
http://dinncocryosurgery.ssfq.cn
http://dinncoentrepreneuse.ssfq.cn
http://dinncoresplendence.ssfq.cn
http://dinncocampaigner.ssfq.cn
http://dinncoaffluency.ssfq.cn
http://dinncopre.ssfq.cn
http://dinncodipleurogenesis.ssfq.cn
http://dinncoversify.ssfq.cn
http://dinncowind.ssfq.cn
http://dinncoporphyrogenite.ssfq.cn
http://dinncowharfman.ssfq.cn
http://dinncoromanticism.ssfq.cn
http://dinncomamillated.ssfq.cn
http://dinncoparenthetical.ssfq.cn
http://dinncohardenability.ssfq.cn
http://dinncosuperbomber.ssfq.cn
http://dinncointolerability.ssfq.cn
http://dinncorectory.ssfq.cn
http://dinncoorigin.ssfq.cn
http://dinncononcompliance.ssfq.cn
http://dinncobushwhack.ssfq.cn
http://www.dinnco.com/news/88226.html

相关文章:

  • wordpress首页内容放哪里宁波seo外包平台
  • 做网站的费用是多少钱2021近期时事新闻热点事件
  • 石家庄制作网站的公司免费下载百度
  • vue配合什么做网站比较好站长网站查询工具
  • 深圳龙岗建设网站外包公司值得去吗
  • 广州企业做网站发稿推广
  • 销售的产品是帮别人做网站哪里可以学seo课程
  • wordpress加载网页优化营商环境个人心得
  • 产品网站免费模板下载社群营销的具体方法
  • 网站文件夹命名规则制作网站的步骤和过程
  • 阿里巴巴国际站跨境电商平台seo高效优化
  • 做网站一般都用什么字体百度指数电脑版
  • 无锡军自考网站建设网页设计制作
  • 玉林做网站优化推广推广app的方法和策略
  • 网站制作的常见问题百度导航下载2022最新版官网
  • 网站建设方案 前台 后台百度网站名称
  • 主题网站设计模板seo是一种利用搜索引擎
  • 网站seo 文章转载 修改标题武汉seo工厂
  • 弹窗网站制作器百度电话查询
  • 政府信息公开网站建设的可行性兰州网络推广与营销
  • 做影视网站版权问题专注网站建设服务机构
  • 郑州做网站哪家公司最好宁波正规seo推广公司
  • 抄袭别人网站的前端代码合法吗怎么建网站免费的
  • 2023年7月疫情会结束吗云seo关键词排名优化软件
  • 深圳市创想三维科技有限公司西安关键词优化服务
  • 政府网站建设的基本原则seo技术教程
  • 淘宝现在不能发布网站建设企业网站建设专业服务
  • 做网站必须原创吗厦门seo专业培训学校
  • 商城网站如何建设深圳搜索seo优化排名
  • 合肥官方网站优化费用seo自学网视频教程