added sources and a quote to notes

This commit is contained in:
Stephen M. McQuay
2012-05-25 10:06:00 -06:00
parent 9a5202821d
commit 4a84a1fe84
3 changed files with 14 additions and 12 deletions
+6 -7
View File
@@ -1,18 +1,17 @@
// based on: http://solarianprogrammer.com/2011/12/16/cpp-11-thread-tutorial/
#include <iostream>
#include <thread>
//This function will be called from a thread
void call_from_thread() {
std::cout << "Hello, World" << std::endl;
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() {
//Launch a thread
std::thread t1(call_from_thread);
//Join the thread with the main thread
std::cout << "printing from original thread" << std::endl;
t1.join();
std::cout << "after join" << std::endl;
return 0;
}