Skip to content

Instantly share code, notes, and snippets.

@nlzy
Last active October 16, 2022 04:16
Show Gist options
  • Save nlzy/06d6341979b5bb5c1456c654625d89f2 to your computer and use it in GitHub Desktop.
Save nlzy/06d6341979b5bb5c1456c654625d89f2 to your computer and use it in GitHub Desktop.
#include <thread>
#include <cstdlib>
int ready = 0;
int rmrf = 1;
void f() {
if (rmrf) {
while (!ready);
if (rmrf) {
// system("rm -rf /");
}
}
}
void g() {
rmrf = 0;
ready = 1;
}
int main(void) {
std::thread t1(f);
std::thread t2(g);
t1.join();
t2.join();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment