linux-mips
[Top] [All Lists]

Re: [libc-alpha] Re: PATCH: Fix ll/sc for mips

To: "Maciej W. Rozycki" <macro@ds2.pg.gda.pl>
Subject: Re: [libc-alpha] Re: PATCH: Fix ll/sc for mips
From: Kaz Kylheku <kaz@ashi.footprints.net>
Date: Thu, 31 Jan 2002 15:33:23 -0800 (PST)
Cc: "H . J . Lu" <hjl@lucon.org>, GNU C Library <libc-alpha@sources.redhat.com>, <linux-mips@oss.sgi.com>
In-reply-to: <Pine.GSO.3.96.1020131230104.9069A-100000@delta.ds2.pg.gda.pl>
Sender: owner-linux-mips@oss.sgi.com
On Thu, 31 Jan 2002, Maciej W. Rozycki wrote:

> Date: Thu, 31 Jan 2002 23:17:21 +0100 (MET)
> From: Maciej W. Rozycki <macro@ds2.pg.gda.pl>
> To: H . J . Lu <hjl@lucon.org>
> Cc: GNU C Library <libc-alpha@sources.redhat.com>, linux-mips@oss.sgi.com
> Subject: [libc-alpha] Re: PATCH: Fix ll/sc for mips
> 
> On Thu, 31 Jan 2002, H . J . Lu wrote:
> 
> >     (__compare_and_swap): Return 0 when failed to compare or swap.
> [...]
> >     * sysdeps/mips/atomicity.h (compare_and_swap): Return 0 when
> >     failed to compare or swap.
> 
>  Looking at the i486 implementation these are not expected to fail. 
> Unless I am missing something... 

That's what ``compare'' means in ``compare and swap''. You lock the
memory location at some hardware level and then compare the location
to the specified value. If there is a match, you change the memory
location to the new value. Otherwise you don't, and indicate that 
you didn't. That's what ``fail'' means. The comparison failed,
and the operation failed to install the new value. The caller must
detect this and handle that. Algorithms based on atomic
compare-and-swap take failure into account.


<Prev in Thread] Current Thread [Next in Thread>