aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/nptl
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2021-11-17 12:20:13 +0100
committerFlorian Weimer <fweimer@redhat.com>2021-11-17 12:20:13 +0100
commit8bd336a00a5311bf7a9e99b3b0e9f01ff5faa74b (patch)
tree64f0019eef9c7d820a768f5a40d6386a1ab91184 /sysdeps/nptl
parenta43c0b5483da4c5e3796af309864cb44256c02db (diff)
downloadglibc-8bd336a00a5311bf7a9e99b3b0e9f01ff5faa74b.tar
glibc-8bd336a00a5311bf7a9e99b3b0e9f01ff5faa74b.tar.gz
glibc-8bd336a00a5311bf7a9e99b3b0e9f01ff5faa74b.tar.bz2
glibc-8bd336a00a5311bf7a9e99b3b0e9f01ff5faa74b.zip
nptl: Extract <bits/atomic_wide_counter.h> 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 <adhemerval.zanella@linaro.org>
Diffstat (limited to 'sysdeps/nptl')
-rw-r--r--sysdeps/nptl/bits/thread-shared-types.h22
1 files changed, 4 insertions, 18 deletions
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 <bits/pthreadtypes-arch.h>
+#include <bits/atomic_wide_counter.h>
+
/* 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;