Код: Выделить всё
std::atomic data(0);
void func() {
data.store(1234, std::memory_order_seq_cst);
}
int main() {
std::thread t(func);
int val = data.load(std::memory_order_seq_cst);
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/76915902/non-deterministic-read-values-when-using-stdatomic-store-load-with-stdmemory[/url]
Мобильная версия