Heikki Linnakangas <hlinnakangas@vmware.com> writes:
> On 09/24/2014 07:57 PM, Andres Freund wrote:
>> On 2014-09-24 12:44:09 -0400, Tom Lane wrote:
>>> I think the question is more like "what in the world happened to confining
>>> ourselves to a small set of atomics".
>> I fail to see why the existance of a wrapper around compare-exchange
>> (which is one of the primitives we'd agreed upon) runs counter to
>> the agreement that we'll only rely on a limited number of atomics on the
>> hardware level?
> It might be a useful function, but if there's no hardware implementation
> for it, it doesn't belong in atomics.h. We don't want to turn it into a
> general library of useful little functions.
Note that the spinlock code separates s_lock.h (hardware implementations)
from spin.h (a hardware-independent abstraction layer). Perhaps there's
room for a similar separation here. I tend to agree with Heikki that
wrappers around compare-exchange ought not be conflated with
compare-exchange itself, even if there might theoretically be
architectures where the wrapper function could be implemented directly.
regards, tom lane