This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH roland/lll-futex] Separate Linuxisms from lowlevellock.h, make a generic one
- From: Andreas Schwab <schwab at suse dot de>
- To: Bernard Ogden <bernie dot ogden at linaro dot org>
- Cc: Roland McGrath <roland at hack dot frob dot com>, "GNU C. Library" <libc-alpha at sourceware dot org>
- Date: Mon, 07 Jul 2014 14:03:24 +0200
- Subject: Re: [PATCH roland/lll-futex] Separate Linuxisms from lowlevellock.h, make a generic one
- Authentication-results: sourceware.org; auth=none
- References: <20140702231404 dot F04F32C3978 at topped-with-meat dot com> <4AA4F932-96E7-490D-B8F0-4D01F6DEB964 at linaro dot org>
Bernard Ogden <bernie.ogden@linaro.org> writes:
> On 3 Jul 2014, at 00:14, Roland McGrath <roland@hack.frob.com> wrote:
>
>> +#define __lll_robust_trylock(futex, id) \
>> + (atomic_compare_and_exchange_val_acq (futex, id, 0) != 0)
>
> My first thought was that the != 0 is superfluous. Either way you return 0
> if you changed the memory, and non-zero if you didn't.
>
> But looking at the call in pthread_mutex_trylock.c, I wonder if both
> patches have this wrong. Should we be returning the old value here? That's
> what (at least) m68k does, so there's a difference that'll need resolving.
Looks like x86 and powerpc do that too, and all other archs got this
wrong.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."