On Thu, Nov 21, 2013 at 1:04 PM, Tim Blechmann
hmmm, i see your points ... however in a way, i'd prefer if this functionality could be built upon boost.atomic, mainly to keep API compatibility with std::atomics.
I suppose, the extensions could be made just as functions. What I don't like about this approach is the need to cast pointers to atomic<> to pointers to the underlying integers. We have a few places in Boost.Sync with such code and it really bothers me. Do you think we could at least add a method to get the pointer or reference to the internal storage inside atomic<>?
with compiler-support for c++11 atomics, the first two instructions could probably be generated by a smart compiler ...
Although theoretically possible, I don't think that current compilers are able to transform a CAS loop with an operation to an in-place operation. Especially, if CAS is implemented in inline assembler. It's a little easier with inc/dec but in practice I've never seen such transformation done automatically.
bts/btr may be useful, but i suppose they are rather specific to x86? i wonder, how would they map to arm?
AFAIK, ARM implements atomic ops with LL/SC instructions, so it should be flexible enough to implement it. I'm not very familiar with the architecture though.
but, yes ... if you think it is reasonable to add them, please go ahead!
Thanks.