Liste des Groupes | Revenir à c arch |
On 12/17/24 15:41, Chris M. Thomasson wrote:I know to use the "strong" version for certain state machines. Where a CAS failure actually means the comparands are different.>Most likely LL/SC in the implementation. If you are calling
Agreed. Humm... The CAS is interesting to me.
>
atomic_compare_exchange_weak
atomic_compare_exchange_strong
>
The weak one can fail spuriously... Akin to LL/SC in a sense?
cas in a loop, then the weak form will be safe, it will just
retry. The strong form is if you are not in a loop and the
cas emulation code has extra logic to filter out spurious
failures and retry internally.
Has to be. Alex was all over this back in c.p.t>No sure why that is there. Possibly for non loop usages.
atomic_compare_exchange_weak_explicit
atomic_compare_exchange_strong_explicit
>
A membar for the success path and one for the failure path. Oh that's fun. Sometimes I think its better to use relaxed for all of the atomics and use explicit barriers ala atomic_thread_fence for the order. Well, that is more in line with the SPARC way of doing things... ;^)
>
Les messages affichés proviennent d'usenet.