Last active
October 16, 2022 04:16
-
-
Save nlzy/06d6341979b5bb5c1456c654625d89f2 to your computer and use it in GitHub Desktop.
This file contains 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 characters
#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