cpp11/thread.cc

19 lines
309 B
C++
Raw Normal View History

2012-05-05 08:34:15 -07:00
#include <iostream>
#include <thread>
//This function will be called from a thread
void call_from_thread() {
std::cout << "Hello, World" << std::endl;
}
int main() {
//Launch a thread
std::thread t1(call_from_thread);
//Join the thread with the main thread
t1.join();
return 0;
}