std::atomic<bool> safe_mode = true;
void stupidFunc() {
int i = 0;
while (i <= 10000)
{
if (safe_mode == true)
{
safe_mode = false;
}
else {
safe_mode = true;
}
i++;
}
}
int main()
{
std::thread t(stupidFunc);
t.detach();
for (int i = 0; i <= 10000; i++) {
if (safe_mode) {
cout << "safe_mode: TRUE\n";
}
else {
cout << "safe_mode: FALSE\n";
}
}
system("pause");
return 0;
}