https://en.cppreference.com/w/cpp/atomic/memory_order There is an example of relaxed ordering in the webpage,below is the snapshot of the example:
it says "C is sequenced before D within thread 2".
According to the definition of sequenced-before,which can be found in the page https://en.cppreference.com/w/cpp/language/eval_order, if A is sequenced before B, then evaluation of A will be complete before evaluation of B begins. Since C is sequenced before D within thread 2, C must be completed before D begins, hence the condition part of the last sentence of the snapshot will never be satisfied.
Aucun commentaire:
Enregistrer un commentaire