added two threading examples

This commit is contained in:
Stephen M. McQuay
2012-05-05 09:34:15 -06:00
parent 318f0a9664
commit d0fdff0b62
2 changed files with 46 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#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;
}