I have implemented LL/SC algorithms in the past and they usually fall into one
of three categories:
1) simple compare-and-exchange, which we have (compare_exchange_weak)
2) read-modify-update, which we have (fetch_add, fetch_sub, fetch_xor, etc.)
3) ABA-prevention
I'm guessing the OP wants to do #3. With LL/SC, you can technically flag an ABA
update and reload the operation, avoiding a resource leak. The problem with
this algorithm is that LL/SC cannot guarantee success in the absence of ABA
(read: it has false negatives). And the more code you add between the LL and
the SC, the greater the chance of a false negative. Therefore, it's very
uncommon to do this in higher-level languages, where the compiler is free to
reorder and reschedule code around.
That said, the solution for ABA on CAS platforms may not apply to LL/SC
platforms: the double-wide CAS. ARMv7 has the wider LL/SC, but MIPS doesn't
have it (which is why std::atomic<uint64_t> is backed by a library).
Not to mention we don't have uint128_t in the standard anyway. So solving ABA
is difficult *anyway*.