Il 18/06/2013 10:36, Paolo Bonzini ha scritto: > Important Note: Note that it is important for both threads to access > the same volatile variable in order to properly set up the happens-before > relationship. It is not the case that everything visible to thread A > when it writes volatile field f becomes visible to thread B after it > reads volatile field g. The release and acquire have to "match" (i.e., > be performed on the same volatile field) to have the right semantics. > > Is this final "important note" the difference between ACQ_REL and SEQ_CST?
Based on what I read now, I think I want ACQ_REL for atomic_mb_{read,set}. One can still get SEQ_CST with atomic_xchg (for sets) or atomic_add (adding 0, for reads). Paolo