[PATCH] nptl: Extract <bits/atomic_wide_counter.h> from pthread_cond_common.c
Florian Weimer
fweimer@redhat.com
Wed Nov 3 19:40:00 GMT 2021
* Andreas Schwab:
> On Nov 03 2021, Florian Weimer wrote:
>
>> * Andreas Schwab:
>>
>>> On Nov 02 2021, Florian Weimer via Libc-alpha wrote:
>>>
>>>> +/* Counter that is monotonically increasing (by less than 2**31 per
>>>> + increment), with a single writer, and an arbitrary number of
>>>> + readers. */
>>>> +typedef union
>>>> +{
>>>> + __extension__ unsigned long long int __value64;
>>>> + struct
>>>> + {
>>>> + unsigned int __low;
>>>> + unsigned int __high;
>>>> + } __value32;
>>>> +} __atomic_wide_counter;
>>>
>>> Why doesn't this need to account for endianess?
>>
>> The ABI is not compatible between 64-bit and 32-bit for other reasons
>> (the counters count differently, the 32-bit variant is just 62 bits).
>> You cannot have a shared mapping with different word sizes. I don't
>> think this matters.
>
> Why do you need a union then?
__HAVE_64B_ATOMICS is not available in the installed headers. It's what
governs the choice between the two layouts, and not __WORDSIZE.
Thanks,
Florian
More information about the Libc-alpha
mailing list