06.08.2013 Views

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

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

One More Data Dependency<br />

a = atomic_load(p, memory_order_consume);<br />

atomic_store(q, a, memory_order_relaxed);<br />

atomic_store(r, b, memory_order_relaxed);<br />

S<strong>in</strong>ce <strong>the</strong>re is no data dependency between <strong>the</strong> consume and <strong>the</strong><br />

second store, <strong>the</strong>y are not ordered.<br />

As programmers we need to be very careful about what we expect to<br />

be ordered!<br />

Jonas Skeppstedt (js@cs.lth.se) Lecture 6 2013 45 / 70

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!