Boost logo

Boost :

Subject: Re: [boost] [atomic] Support for specialized instructions
From: tim (tim_at_[hidden])
Date: 2013-11-23 06:37:43


hi andrey,

>> 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<>?

yes, this sounds reasonable ...

>> 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.

true ... though i'm not sure how well it performs: it emulates cas with
ll/sc and atomic ops with cas ... but true, this is another issue and
one of the reasons why i always suggest to use std::atomic if possible ...

cheers,
tim


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk