Created
January 24, 2015 06:52
-
-
Save why-jay/0d124d46eba58f812319 to your computer and use it in GitHub Desktop.
Revisions
-
YJ Yang created this gist
Jan 24, 2015 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ #include <chrono> #include <iostream> #include <thread> #include <vector> using namespace std; int main() { vector<thread> workers; bool isComplete = false; thread t = thread([=] { int i = 0; while (!isComplete) i += 0; }); this_thread::sleep_for(chrono::milliseconds(500)); isComplete = true; t.join(); cout << "complete!" << endl; return 0; }