Subject: Re: Atomic ops API
To: Johnny Billquist <bqt@softjar.se>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 03/16/2007 08:51:48
On Mar 16, 2007, at 2:21 AM, Johnny Billquist wrote:
> Jason Thorpe wrote:
>> Anyway, I've decided to stick with "cas" as "compare-and-store".
>
> I just came up with another question, by the way.
> What is the intended use for this function? Is it mostly for
> spinlocks?
> If so, then I think we should try something else. For the VAX,
> implementing spinlocks is very easy, but they don't match the
> semantics of compare_and_swap or compare_and_store
No, not for spinlocks. There do exist applications that might want a
compare-and-{store,swap}, and the CAS primitive is also used to
implement other atomic operations on many (most?) architectures (such
as atomic-increment, atomic-or, etc.)
>
>
> Johnny
-- thorpej