Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardC++relaxed memory semanticsSingle-choice MCQ

Thread 1 does a relaxed store then a release store; Thread 2 does an acquire load (reading the release) then a relaxed load. Does the acquire/release pair guarantee Thread 2's relaxed load sees Thread 1's relaxed store?

// a, b atomic<int> = 0 // T1: a.store(1, relaxed); b.store(1, release); // T2: if (b.load(acquire) == 1) { r = a.load(relaxed); } // is r guaranteed 1?