[cpp-threads] seq_cst compare_exchange and store-load fencing
Alexander Terekhov
alexander.terekhov at gmail.com
Fri Jan 2 16:23:23 GMT 2009
compare_exchange performs both load and (conditional) store. This
leads to questions regarding store-load fencing for compare_exchange
in seq_cst mode:
Q1) Does it provide store-load fencing in the case of
A.store(relaxed|release) ... B.compare_exchange(..., seq_cst)
regarding A's store and B's load (in either success or failure case of
B's compare_exchange)?
Q2) Does it provide store-load fencing in the case of
B.compare_exchange(..., seq_cst) ... C.load(relaxed|acquire)
regarding B's store and C's load (in success case of B's compare_exchange)?
Under simple interpretation of "seq_cst" meaning "fully-fenced" the
answer to both questions is "yes"...
Do you agree with the same outcome under the proposed C/C++ memory model?
What is your reasoning in case you disagree?
TIA.
regards,
alexander.
More information about the cpp-threads
mailing list