This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH] Unify pthread_spin_[try]lock implementations.
On 11/07/2012, at 9:02 PM, Andrew Haley wrote:
> On 07/11/2012 09:53 AM, Maxim Kuvyrkov wrote:
>
...
>> This is an interesting point and maybe introducing a counter like
>> below will improve spinlocks for ARM.
>>
>> + int counter = 123456;
>> + while (atomic_compare_and_exchange_val_acq (lock, 1, 0) != 0)
>> + while (*lock != 0 && --counter)
>> + ;
>
> This is a much better idea than an unbounded spin.
OK, but this will be a change on its own in a follow up patch. I want to keep this patch just a mechanical change.
--
Maxim Kuvyrkov
CodeSourcery / Mentor Graphics