Threads in the new ISO C Standard from 2011
Threads in the new ISO C Standard from 2011
Threads in the new ISO C Standard from 2011
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Question<br />
Consider <strong>the</strong> code where all variables <strong>in</strong>itially are zero.<br />
// Thread 1<br />
x = atomic_load_explicit(&b, memory_order_relaxed);<br />
atomic_store_explicit(&a, x, memory_order_relaxed);<br />
// Thread 2<br />
y = atomic_load_explicit(&a, memory_order_relaxed);<br />
atomic_store_explicit(&b, 42, memory_order_relaxed);<br />
Can both x and y become 42?<br />
Jonas Skeppstedt (js@cs.lth.se) Lecture 6 2013 10 / 70