[cpp-threads] seq_cst compare_exchange and store-load fencing

Alexander Terekhov alexander.terekhov at gmail.com
Sat Jan 3 14:07:23 GMT 2009


On Sat, Jan 3, 2009 at 2:09 AM, Paul E. McKenney
<paulmck at linux.vnet.ibm.com> wrote:

[... additional 1.10 notes about stunning sec_cst ...]

> Works for me!

Finally, I suggest to add rather simple example or two along the lines of

P1: X.store(relaxed|release); fence(sec_cst); y = Y.load(relaxed|acquire);
P2: Y.store(relaxed|release); fence(sec_cst); x = X.load(relaxed|acquire);

(y=0, x=0 outcome is not allowed)

stressing sec_cst stunning feature of NOT allowing to safely express
the above in terms of

P1: X.store(sec_cst); y = Y.load(relaxed|acquire);
P2: Y.store(sec_cst); x = X.load(relaxed|acquire);

(y=0, x=0 outcome is allowed)

or

P1: X.store(relaxed|release); y = Y.load(sec_cst);
P2: Y.store(relaxed|release); x = X.load(sec_cst);

(y=0, x=0 outcome is allowed)

right?

Wow.

regards,
alexander.



More information about the cpp-threads mailing list