Liste des Groupes | Revenir à cl c++ |
Meanwhile I think I found a bug in my posted code, I should probably use compare_exchange_strong() instead of compare_exchange_weak().Indeed. With ..._weak you most likely need a loop. But if you already have a loop for other purposes using the _weak function could avoid an additional loop in the implementation of the function.
I somehow thought the latter would err on the safe side, but it does not. In my test harness there seems to be no difference.On many platforms the underlying CAS primitives already are strong. In this cases both function are identical.
Les messages affichés proviennent d'usenet.