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.
Atomic Fetch and Modify Functions<br />
These functions atomically read-compute-modify an atomic object.<br />
computation C operator function<br />
addition + atomic_fetch_add_explicit<br />
subtraction - atomic_fetch_sub_explicit<br />
or | atomic_fetch_or_explicit<br />
xor ^ atomic_fetch_xor_explicit<br />
and & atomic_fetch_and_explicit<br />
Plus <strong>the</strong> usual non-explicit functions, for example:<br />
C atomic_fetch_add(volatile A* ptr, M value); adds value<br />
to what A po<strong>in</strong>ts to.<br />
If A is arithmetic <strong>the</strong>n M is C and if it’s atomic_address <strong>the</strong>n M is<br />
ptr_diff_t.<br />
The value of *ptr before <strong>the</strong> operation is returned.<br />
Jonas Skeppstedt (js@cs.lth.se) Lecture 6 2013 17 / 70