Код: Выделить всё
int value;
std::atomic flag;
//Thread 1
{
value = 1;
flag.store(true);
}
//Thread 2
{
value = 2;
if(flag.load())
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79693285/two-potentially-concurrent-conflicting-actions-data-race[/url]
Мобильная версия