std::thread
boost::threadじゃなくて、std::threadでのスレッドプログラム。
#include <thread> std::mutex m; void th_do(int i) { std::lock_guard<std::mutex> lk(m); std::cout << "do! : " << i << std::endl; } int main() { std::vector<std::thread> threads; for (int i = 0; i < 5; ++i) { threads.push_back(std::thread(th_do, i)); } for (int i = 0; i < 5; ++i) { threads[i].join(); } }