aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/htl/sem-destroy.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-13 15:14:40 +0000
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-12-16 01:58:33 +0100
commitc8f9421298f5f973b31a7cbbc76e61b06eca03bc (patch)
tree86bf4c058624d76b6e35fd44f1f506c3ad9b3d94 /sysdeps/htl/sem-destroy.c
parent644d98ec4d8405e9b721ecb715483ea1983e116f (diff)
downloadglibc-c8f9421298f5f973b31a7cbbc76e61b06eca03bc.tar
glibc-c8f9421298f5f973b31a7cbbc76e61b06eca03bc.tar.gz
glibc-c8f9421298f5f973b31a7cbbc76e61b06eca03bc.tar.bz2
glibc-c8f9421298f5f973b31a7cbbc76e61b06eca03bc.zip
htl: Add pshared semaphore support
The implementation is extremely similar to the nptl implementation, but with slight differences in the futex interface. This fixes some of BZ 25521.
Diffstat (limited to 'sysdeps/htl/sem-destroy.c')
-rw-r--r--sysdeps/htl/sem-destroy.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sysdeps/htl/sem-destroy.c b/sysdeps/htl/sem-destroy.c
index 4caa004444..ebfeb2a0e6 100644
--- a/sysdeps/htl/sem-destroy.c
+++ b/sysdeps/htl/sem-destroy.c
@@ -24,7 +24,15 @@
int
__sem_destroy (sem_t *sem)
{
- if (sem->__queue)
+ struct new_sem *isem = (struct new_sem *) sem;
+ if (
+#if __HAVE_64B_ATOMICS
+ atomic_load_relaxed (&isem->data) >> SEM_NWAITERS_SHIFT
+#else
+ atomic_load_relaxed (&isem->value) & SEM_NWAITERS_MASK
+ || isem->nwaiters
+#endif
+ )
/* There are threads waiting on *SEM. */
{
errno = EBUSY;