Suppose I use CAS inside a loop that contains a number of operations other than the CAS. The loop runs until the CAS succeeds. Should I use the weak version of CAS? Or will it be non cost effective to redo all the loop's operations in case the CAS spuriously fail, and I'd better use the strong version of CAS to ensure repeating the loop only if the CAS really had to fail (because object
!= expected
)? Or is there no theoretical answer and I should try both versions and compare their performance?
samedi 31 décembre 2016
Is atomic_compare_exchange_weak preferable over the strong version even in a long loop?
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire