Quantcast
Channel: In C++, is there any effective difference between a acquire/release atomic access and a relaxed access combined with a fence? - Stack Overflow
Browsing index pages (3 articles)

In C++, is there any effective difference between a acquire/release atomic...

Specifically, is there any effective difference between:i = a.load(memory_order_acquire);ora.store(5, memory_order_release);andatomic_thread_fence(memory_order_acquire);i =...

View Article


Answer by cshu for In C++, is there any effective difference between a...

You needatomic_thread_fence(memory_order_release);a.store(5, memory_order_relaxed);andi = a.load(memory_order_relaxed);atomic_thread_fence(memory_order_acquire);To replacea.store(5,...

View Article


Answer by LWimsey for In C++, is there any effective difference between a...

In your code, for both load and store, the order between the fence and the atomic operation should be reversed and then it is similar to the standalone operations, but there are differences.Acquire and...

View Article
Browsing index pages (3 articles)


Latest Images