Ticket #11796: thread.cpp

File thread.cpp, 340 bytes (added by saboorian@…, 7 years ago)
Line 
1#include <boost/thread.hpp>
2#include <boost/chrono.hpp>
3#include <iostream>
4boost::thread th;
5int main(){
6
7 for(auto ti=0; ti<100000; ti++){
8 th.detach();
9 th = //commenting this line fixes the memory issue
10 boost::thread([ti](){
11 std::cout << ti << std::endl;
12 });
13 }
14 std::string st;
15
16 std::cin >> st;
17 return 0;
18}