1. 安装gcc,g++,make等开发环境

yum groupinstall "Development Tools"

2. 安装boost

yum install boost boost-devel boost-doc
备注:默认的安装路径在/usr/lib64目录下

3. 例子

#include <boost/thread.hpp>
#include <iostream>  

void task1() {
    // do stuff
    std::cout << "This is task1!" << std::endl;
}  

void task2() {
    // do stuff
    std::cout << "This is task2!" << std::endl;
}  

int main (int argc, char ** argv) {
    using namespace boost;
    thread thread_1 = thread(task1);
    thread thread_2 = thread(task2);  

    // do other stuff
    thread_2.join();
    thread_1.join();
    ;
} 

4. 编译

g++ -I./inlcude -L./usr/lib64  asio_thread.cpp -lboost_thread-mt  -o example

5.运行:

This is task2!
This is task1!

最新文章

  1. 让VS2010支持Windows2000
  2. .Net的内置对象之一 Request
  3. Bash 中 SHLVL 变量为 1000 的时候
  4. javascript运行模式:并发模型 与Event Loop
  5. bzoj4400: tjoi2012 桥
  6. 转载~kxcfzyk:Linux C语言多线程库Pthread中条件变量的的正确用法逐步详解
  7. 【linux】xrander/cvt自定义分辨率
  8. CallableAndFuture
  9. 虚拟攻防系统 HoneyPot
  10. Linux/Ubuntu下 静态编译Qt程序
  11. struts2 result type的类型
  12. Http2改造实践:statusText丢失问题
  13. Linux系列教程(十二)——Linux软件包管理之yum在线管理
  14. Mybatis实现 --文件夹
  15. UWP 图片模糊
  16. java集合类,HashMap,ArrayList
  17. Vue proxyTable 解决开发环境的跨域问题
  18. ApiCloud开发经验总结
  19. Python 3 实现定义跨模块的全局变量和使用
  20. android studio 怎么做屏幕适配?

热门文章

  1. Objective C 快速入门学习一
  2. phpcms常用方法简介
  3. SQL 执行计划(二)
  4. 小波变换C++实现(一)----单层小波变换
  5. [转载]Python 3.5 协程究竟是个啥
  6. IDEA Error:java: 未结束的字符串文字
  7. ios NSURLSession completeHandler默认调用quque
  8. Effective C++ -----条款40:明智而审慎地使用多重继承
  9. Effective C++ -----条款24:若所有参数皆需类型转换,请为此采用non-member函数
  10. js判断手机端操作系统(Andorid/IOS),并自动为链接添加相应下载地址