Subject: Re: Atomic ops API
To: SODA Noriyuki <soda@sra.co.jp>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 03/13/2007 08:16:10
On Mar 12, 2007, at 11:55 PM, SODA Noriyuki wrote:
>
>>
>>>
>>>>
>>>>>
>>>>>> On Mon, 12 Mar 2007 23:28:47 -0700,
> Jason Thorpe <thorpej@shagadelic.org> said:
>
>> There is one major difference, however. Solaris defines "cas" as
>> COMPARE-AND-SWAP, returning the previous value of the memory cell.
>> I have defined it as COMPARE-AND- STORE, returning true if the ops
>> succeeds, or false otherwise. The reason for this is because some
>> platforms will have extreme difficulty implementing
>> COMPARE-AND-SWAP, whereas COMPARE-AND-STORE is somewhat easier for
>> these platforms.
>
> In that case, the functions should use a different name instead of
> *_cas_*(), shouldn't they?
Oh, and dunno... m68k called it "compare-and-set" long before Solaris
called it "compare-and-swap" :-) Besides, the _lock_cas() we already
have in our kernel on many platforms already uses the "cas" name for a
compare-and-store operation.
>
> e.g.
> *_csi_* (compare and store interlocked)?
> *_cs_* (compare and store)?
> --
> soda
-- thorpej