diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-12-13 15:14:40 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2020-12-16 01:58:33 +0100 |
commit | c8f9421298f5f973b31a7cbbc76e61b06eca03bc (patch) | |
tree | 86bf4c058624d76b6e35fd44f1f506c3ad9b3d94 /sysdeps/htl/sem-getvalue.c | |
parent | 644d98ec4d8405e9b721ecb715483ea1983e116f (diff) | |
download | glibc-c8f9421298f5f973b31a7cbbc76e61b06eca03bc.zip glibc-c8f9421298f5f973b31a7cbbc76e61b06eca03bc.tar.gz glibc-c8f9421298f5f973b31a7cbbc76e61b06eca03bc.tar.bz2 |
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-getvalue.c')
-rw-r--r-- | sysdeps/htl/sem-getvalue.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sysdeps/htl/sem-getvalue.c b/sysdeps/htl/sem-getvalue.c index 2d72a63..728f763 100644 --- a/sysdeps/htl/sem-getvalue.c +++ b/sysdeps/htl/sem-getvalue.c @@ -22,9 +22,13 @@ int __sem_getvalue (sem_t *restrict sem, int *restrict value) { - __pthread_spin_wait (&sem->__lock); - *value = sem->__value; - __pthread_spin_unlock (&sem->__lock); + struct new_sem *isem = (struct new_sem *) sem; + +#if __HAVE_64B_ATOMICS + *value = atomic_load_relaxed (&isem->data) & SEM_VALUE_MASK; +#else + *value = atomic_load_relaxed (&isem->value) >> SEM_VALUE_SHIFT; +#endif return 0; } |