Skip to content

Instantly share code, notes, and snippets.

@why-jay
Created January 24, 2015 06:52
Show Gist options
  • Save why-jay/0d124d46eba58f812319 to your computer and use it in GitHub Desktop.
Save why-jay/0d124d46eba58f812319 to your computer and use it in GitHub Desktop.
#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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment