// based on: http://solarianprogrammer.com/2011/12/16/cpp-11-thread-tutorial/ #include #include void call_from_thread() { std::cout << "sleeping in the thread" << std::endl; std::this_thread::sleep_for(std::chrono::milliseconds(1000)); std::cout << "finishing in thread" << std::endl; } int main() { std::thread t1(call_from_thread); std::cout << "printing from original thread" << std::endl; t1.join(); std::cout << "after join" << std::endl; return 0; }