From 8bd336a00a5311bf7a9e99b3b0e9f01ff5faa74b Mon Sep 17 00:00:00 2001 From: Florian Weimer Date: Wed, 17 Nov 2021 12:20:13 +0100 Subject: nptl: Extract from pthread_cond_common.c And make it an installed header. This addresses a few aliasing violations (which do not seem to result in miscompilation due to the use of atomics), and also enables use of wide counters in other parts of the library. The debug output in nptl/tst-cond22 has been adjusted to print the 32-bit values instead because it avoids a big-endian/little-endian difference. Reviewed-by: Adhemerval Zanella --- sysdeps/nptl/bits/thread-shared-types.h | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) (limited to 'sysdeps') diff --git a/sysdeps/nptl/bits/thread-shared-types.h b/sysdeps/nptl/bits/thread-shared-types.h index 44bf1e358d..b82a79a43e 100644 --- a/sysdeps/nptl/bits/thread-shared-types.h +++ b/sysdeps/nptl/bits/thread-shared-types.h @@ -43,6 +43,8 @@ #include +#include + /* Common definition of pthread_mutex_t. */ @@ -91,24 +93,8 @@ typedef struct __pthread_internal_slist struct __pthread_cond_s { - __extension__ union - { - __extension__ unsigned long long int __wseq; - struct - { - unsigned int __low; - unsigned int __high; - } __wseq32; - }; - __extension__ union - { - __extension__ unsigned long long int __g1_start; - struct - { - unsigned int __low; - unsigned int __high; - } __g1_start32; - }; + __atomic_wide_counter __wseq; + __atomic_wide_counter __g1_start; unsigned int __g_refs[2] __LOCK_ALIGNMENT; unsigned int __g_size[2]; unsigned int __g1_orig_size; -- cgit v1.2.3