Boost C++ is Cpp programming language that provides support for tasks and structures

Download Source

https://dl.bintray.com/boostorg/release/1.73.0/source/boost_1_73_0.tar.gz
tar zxvf boost(解压)

Set use GCC

cd boost
./bootstrap.sh --with-libraries=all --with-toolset=gcc

Compile & Install boost

./b2 toolset=gcc
./b2 install --prefix=/usr

Test programming

#include <boost/thread/thread.hpp> //boost thread
#include <iostream>
#include <cstdlib>
using namespace std;

volatile bool isRuning = true;

void func1()
{
    static int cnt1 = 0;
    while(isRuning)
    {
        cout << "func1:" << cnt1++ << endl;
        sleep(1);
    }
}

void func2()
{
    static int cnt2 = 0;
    while(isRuning)
    {
        cout << "\tfunc2:" << cnt2++ << endl;
        sleep(2);
    }
}

int main()
{
    boost::thread thread1(&func1);
    boost::thread thread2(&func2);

    system("read");
    isRuning = false;

    thread2.join();
    thread1.join();
    cout << "exit" << endl;
    return 0;
}

g++ main.cpp -g -o main -lboost_thread -lpthread