Subject: re: Atomic ops API
To: Jason Thorpe <thorpej@shagadelic.org>
From: matthew green <mrg@eterna.com.au>
List: tech-kern
Date: 03/14/2007 06:56:32
   
   >> 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.

i think i agree with soda.  if you're going to use the solaris
implementation but with this one change, it seems you should 
call the functions something different to avoid the possibility
of people being confused.


.mrg.