See also
Should we add books on particular topics as external links/see also? "C++ Concurrency in Action" explains this part well, --Cubbi 19:17, 21 September 2011 (PDT)
- Sure, let's have an 'External links' section at the end of the page in question.P12 20:29, 21 September 2011 (PDT)
 std::memory_order_release and memory_order_acquire example
In this example, both writes have release order and both reads have acquire order. Wouldn't it be sufficient that the second write has release order and the second read has acquire order? 22.214.171.124 04:50, 21 November 2011 (PST)
- No: release on the store to y but not on the store to x would only guarantee that store to x happens-before store to y from the point of view of thread 1 and any thread that loads from y with at least memory_order_acquire (not consume or relaxed). You're suggesting that load from y is relaxed, that means no synchronization whatsoever, assert may fail --Cubbi 07:14, 21 November 2011 (PST)
- I think this example is doing more synchronization than is required. It would work equally well if the x.store in thread1 used std::memory_order_relaxed and the x.load in thread2 used std::memory_order_relaxed. Also it would work equally well if x was just a regular int, not std::atomic<int>. It might be more instructive/realistic to make x a regular int in this example to show the power of an acquire/release pair.