1 // Copyright (C) 2015 Vicente Botet 2 // 3 // Distributed under the Boost Software License, Version 1.0. (See accompanying 4 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) 5 6 #include <boost/thread.hpp> 7 #include <boost/chrono.hpp> 8 #include <iostream> 9 10 boost::thread th; main()11int main() 12 { 13 14 for (auto ti = 0; ti < 1000; ti++) 15 { 16 th = boost::thread([ti]() 17 { 18 boost::this_thread::sleep_for(boost::chrono::milliseconds(100)); 19 std::cout << ti << std::endl; 20 }); 21 } 22 std::string st; 23 24 std::cin >> st; 25 26 // for (int i = 0; i < 10; ++i) { 27 // std::cout << "." << i << std::endl; 28 // boost::this_thread::sleep_for(boost::chrono::milliseconds(100)); 29 // } 30 th.join(); 31 return 0; 32 } 33 34