Quantcast
Channel: Can a write to std::atomic go unseen by other threads while using std::atomic::compare_exchange_strong? - Stack Overflow
Browsing latest articles
Browse All 2 View Live

Answer by Paul Sanders for Can a write to std::atomic go unseen by other...

So, to provide a definitive answer to this, no, a write from thread1 will never be missed by thread0.This is because std::atomic::compare_exchange_strong is an atomic operation so the write from...

View Article


Can a write to std::atomic go unseen by other threads while using...

std::atomic<int> g_atomic;void thread0(){ int oldVal = 0; int newVal = 1; while (g_atomic.compare_exchange_strong(oldVal, newVal, std::memory_order_acq_rel, std::memory_order_acquire)) { //...

View Article

Browsing latest articles
Browse All 2 View Live


Latest Images