Answer by Humphrey Winnebago for Why "memory_order_relaxed" treat as...
The reordering is possible. Your experiment is just a little loosey goosey.The reordering ("22 : 22") IS allowed on x86. x86 allows store-load reordering, i.e. Within a thread, a load can complete...
View ArticleAnswer by Nicol Bolas for Why "memory_order_relaxed" treat as...
Just because the standard says that a particular eventuality is possible does not mean that what causes it to happen is governed by random numbers. On real machines, the result of unspecified behavior...
View ArticleWhy "memory_order_relaxed" treat as "memory_order_seq_cst" in my system [C++]
My Code :std::atomic<int> x(22) , y(22);int temp_x = -1, temp_y = -1;void task_0(){ x.store(33, std::memory_order_relaxed); temp_y = y.load(std::memory_order_relaxed);}void task_1(){ y.store(33,...
View Article
More Pages to Explore .....