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

上传网站安装教程视频wordpress大前端主题怎么样

上传网站安装教程视频,wordpress大前端主题怎么样,如何开网站呢,金融公司网站方案原标题#xff1a;C11并发编程#xff1a;多线程std:thread一#xff1a;概述C11引入了thread类#xff0c;大大降低了多线程使用的复杂度#xff0c;原先使用多线程只能用系统的API#xff0c;无法解决跨平台问题#xff0c;一套代码平台移植#xff0c;对应多线程代码…原标题C11并发编程多线程std:thread一概述C11引入了thread类大大降低了多线程使用的复杂度原先使用多线程只能用系统的API无法解决跨平台问题一套代码平台移植对应多线程代码也必须要修改。现在在C11中只需使用语言层面的thread可以解决这个问题。所需头文件二构造函数1.默认构造函数thread() noexcept一个空的std::thread执行对象2.初始化构造函数templateexplicit thread(Fn fn, Args... args);创建std::thread执行对象线程调用threadFun函数函数参数为args。void threadFun(int a){cout this is thread fun ! endl;}thread t1(threadFun, 2);3.拷贝构造函数thread(const thread) delete;拷贝构造函数被禁用std::thread对象不可拷贝构造void threadFun(int a){cout this is thread fun ! endl;}int value 2;thread t1(threadFun, std::ref(value));4.Move构造函数thread(thread x)noexcept调用成功原来x不再是std::thread对象void threadFun(int a){cout this is thread fun ! endl;}int value 2;thread t1(threadFun, std::ref(value));thread t2(std::move(t1));t2.join();三成员函数1.get_id()获取线程ID返回类型std::thread::id对象。thread t1(threadFun);thread::id threadId t1.get_id();cout 线程ID threadId endl;//threadId转换成整形值所需头文件ostringstream oss;oss t1.get_id();string strId oss.str();unsigned long long tid stoull(strId);cout 线程ID tid endl;2.join()创建线程执行线程函数调用该函数会阻塞当前线程直到线程执行完join才返回。thread t1(threadFun);t1.join() //阻塞等待3.detach()detach调用之后目标线程就成为了守护线程驻留后台运行与之关联的std::thread对象失去对目标线程的关联无法再通过std::thread对象取得该线程的控制权。4.swap()交换两个线程对象thread t1(threadFun1);thread t2(threadFun2);cout 线程1的ID t1.get_id() endl;cout 线程2的ID t2.get_id() endl;t1.swap(t2);cout 线程1的ID t1.get_id() endl;cout 线程2的ID t2.get_id() endl;5.hardware_concurrency()获得逻辑处理器储量,返回值为int型int coreNum thread::hardware_concurrency();四使用1.创建线程void threadFun1(){cout this is thread fun1 ! endl;}int main(){thread t1(threadFun1);t1.join();getchar();return 1;}2.创建线程传参void threadFun1(int v){cout this is thread fun1 ! endl;cout v endl;}int main(){int value 6;thread t1(threadFun1, value);t1.join();getchar();return 1;}需要注意变量int value 和int v 做变量传递时并不是引用而是对变量做了拷贝所以在传递给int v前int value不能出作用域(释放了内存)join()可以保证int value变量释放内存如果使用detach()可能存在这种情况。3.创建线程引用传参void threadFun1(int v){cout this is thread fun1 ! endl;cout v endl;}int main(){int value 6;thread t1(threadFun1, std::ref(value));t1.join();getchar();return 1;}4.创建建线程线程函数为类成员函数class Object{public:Object(){cout 构造函数 endl;}~Object(){cout 析构函数 endl;}void fun(string info){cout info endl;}};int main(){Object obj;string str 我是一个类的成员函数;thread t1(Object::fun, obj, str);t1.join();getchar();return 1;---------------------作者蜗牛201原文https://blog.csdn.net/woniu211111/article/details/85123281责任编辑
http://www.huolong8.cn/news/76495/

相关文章:

  • 网站开发 法律网上书城网站开发背景
  • 广州网站建设正规公司做psd模板下载网站
  • 网站运行及维护wordpress权限设置方法
  • 17zwd一起做业网站免费网站推广网站在线
  • 政务公开网站开发江门专业网站建设公司
  • 做电商哪几个设计网站比较好境内境外网站区别
  • 网站维护模式企业建设网站没有服务器
  • 网站设计跟网页制作河北集团网站建设
  • 昭通网站建设兼职网站开发的就业方向
  • 贵州省教育厅办公室关于开展2014年学校门户网站建设评估的通知银川企业网站设计制作
  • 网站开发校园经历范文购物网站搜索功能怎么做
  • seo蒙牛伊利企业网站专业性诊断网络系统搭建
  • 传诚信网站建设diy网站开发公司
  • 昆明网站推广优化公司免费音效素材网站
  • 购物网站开发设计类图新手建什么网站赚钱
  • 网站有些什么内容做网站多少钱 优帮云
  • me域名公司网站深圳宝安区有哪些街道
  • 建设网站怎么判断是电脑还是手机阿里云服务器免费一年
  • 做网站如何月入10万建设企业网站需要了解什么
  • 小网站的制作网站首页设计图
  • 旅游精品网站建设建筑公司logo设计大全
  • 汽车配件生产企业网站模板南通哪里做网站
  • 网站开发类专业服务文案开源 wordpress 主题
  • 单位网站和新媒体建设制度中小企业网站建设济南兴田德润o厉害吗
  • 自己电脑建设网站苏州网站运营公司
  • 如何制作自己网站淘宝的网站建设费用
  • 做算命网站网站片头怎么做
  • 怎么建设可以收费的网站dede网站源码
  • 多元网站建设德庆网站建设价格
  • 广州知名的网站建设公司哈尔滨信息网租房信息