[PATCH] Define __PTHREAD_MUTEX_HAVE_PREV only if undefined [BZ #22298]

H.J. Lu hjl.tools@gmail.com
Mon Oct 16 14:58:00 GMT 2017


On Mon, Oct 16, 2017 at 7:31 AM, Andreas Schwab <schwab@suse.de> wrote:
> On Okt 16 2017, Adhemerval Zanella <adhemerval.zanella@linaro.org> wrote:
>
>> diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h
>> index 68b82b6..5dfe01e 100644
>> --- a/sysdeps/nptl/bits/thread-shared-types.h
>> +++ b/sysdeps/nptl/bits/thread-shared-types.h
>> @@ -58,8 +58,7 @@
>>  #include <bits/pthreadtypes-arch.h>
>>
>>  /* Common definition of pthread_mutex_t. */
>> -
>> -#if __WORDSIZE == 64
>> +#if __PTHREAD_MUTEX_HAVE_PREV
>>  typedef struct __pthread_internal_list
>>  {
>>    struct __pthread_internal_list *__prev;
>> @@ -74,7 +73,7 @@ typedef struct __pthread_internal_slist
>>
>>  /* Lock elision support.  */
>>  #if __PTHREAD_MUTEX_LOCK_ELISION
>> -# if __WORDSIZE == 64
>> +# if __PTHREAD_MUTEX_HAVE_PREV
>>  #  define __PTHREAD_SPINS_DATA       \
>>    short __spins;             \
>>    short __elision
>> @@ -101,17 +100,16 @@ struct __pthread_mutex_s
>>    int __lock __LOCK_ALIGNMENT;
>>    unsigned int __count;
>>    int __owner;
>> -#if __WORDSIZE == 64
>> +#if __PTHREAD_MUTEX_HAVE_PREV
>>    unsigned int __nusers;
>>  #endif
>
> The name doesn't really fit here.  There is nothing matching prev in
> __nusers or __PTHREAD_SPINS_DATA.
>

True.  But they are tied together.

-- 
H.J.



More information about the Libc-alpha mailing list