boost库中thread多线程详解6——线程组简单例子
来源:互联网 发布:centos 权限不够 编辑:程序博客网 时间:2024/05/29 14:27
- namespace
- {
- struct Run
- {
- void operator()(void)
- {
- std::cout << __FUNCTION__ << std::endl;
- }
- };
- void run(void)
- {
- std::cout << __FUNCTION__ << std::endl;
- }
- }
- void test_thread_group2()
- {
- Run r;
- boost::thread_group grp;
- // 两种方法通过线程组增加线程
- boost::thread *t = grp.create_thread(r); // 使用create_thread
- grp.add_thread(new boost::thread(run)); // 使用add_thread
- grp.join_all();
- // 两种方法移除线程
- grp.remove_thread(t);
- // delete t;
- }
- 【Boost】boost库中thread多线程详解6——线程组简单例子
- 【Boost】boost库中thread多线程详解6——线程组简单例子
- boost库中thread多线程详解6——线程组简单例子
- 【Boost】boost库中thread多线程详解7——wait与timed_wait简单例子
- 【Boost】boost库中thread多线程详解7——wait与timed_wait简单例子
- 【Boost】boost库中thread多线程详解5——谈谈线程中断
- 【Boost】boost库中thread多线程详解5——谈谈线程中断
- 【Boost】boost库中thread多线程详解9——thread_specific_ptr线程局部存储
- 【Boost】boost库中thread多线程详解11——线程的休眠和中断
- 【Boost】boost库中thread多线程详解12——线程的分离与非分离
- 【Boost】boost库中thread多线程详解13——线程标识符
- 【Boost】boost库中thread多线程详解5——谈谈线程中断
- boost库中thread多线程详解5——谈谈线程中断
- boost库中thread多线程详解5——谈谈线程中断
- 【Boost】boost库中thread多线程详解1——thread入门与简介
- 【Boost】boost库中thread多线程详解2——mutex与lock
- 【Boost】boost库中thread多线程详解3——细说lock_guard
- 【Boost】boost库中thread多线程详解4——谈谈recursive_mutex(递归式互斥量)
- boost库中thread多线程详解5——谈谈线程中断
- 向Tiny210移植Debian Linux
- iis
- HDU 4599 Dice 2013 ACM-ICPC吉林通化全国邀请赛J题
- 上拉电阻下拉电阻的总结
- boost库中thread多线程详解6——线程组简单例子
- weblogic集群部署 bea-000141错误解决
- HDU1864----最大报销额
- 笔试常见题----新建了几个对象??
- boost库asio详解1——strand与io_service区别
- visifire 饼状图加图例
- android 中Dialog对话框及自定义Dialog的方法
- 生成tags
- boost库asio详解2——io_service::run函数无任务时退出的问题