Код: Выделить всё
#include
#include
#include
std::atomic canceller = {0};
int main() {
auto t1 = std::thread([]() {
auto v = canceller.fetch_add(1, std::memory_order::relaxed); // #0
std::thread([v]() {
int current = v + 1;
if (canceller.load(std::memory_order::relaxed)==current) { // #1
std::cout
Подробнее здесь: [url]https://stackoverflow.com/questions/79838504/should-we-judge-whether-programs-are-functionally-equivalent-based-on-identical[/url]