diff options
author | Sergey Bugaev <bugaevc@gmail.com> | 2023-02-12 14:10:36 +0300 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2023-02-12 15:57:32 +0100 |
commit | 3d008a92a816d4fcf07701f2d28dd8d6f9244b3b (patch) | |
tree | ceac3572d4fb4d872f3d8c1dc45b8aca3d00f036 | |
parent | 48941024bab62ebbd3588dc0d75ba0a6db9ea389 (diff) | |
download | glibc-3d008a92a816d4fcf07701f2d28dd8d6f9244b3b.zip glibc-3d008a92a816d4fcf07701f2d28dd8d6f9244b3b.tar.gz glibc-3d008a92a816d4fcf07701f2d28dd8d6f9244b3b.tar.bz2 |
htl: Fix semaphore reference
'sem' is the opaque 'sem_t', 'isem' is the actual 'struct new_sem'.
Signed-off-by: Sergey Bugaev <bugaevc@gmail.com>
Message-Id: <20230212111044.610942-6-bugaevc@gmail.com>
-rw-r--r-- | sysdeps/htl/sem-timedwait.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/sysdeps/htl/sem-timedwait.c b/sysdeps/htl/sem-timedwait.c index 8f2df6e..9974e9a 100644 --- a/sysdeps/htl/sem-timedwait.c +++ b/sysdeps/htl/sem-timedwait.c @@ -60,7 +60,7 @@ __sem_timedwait_internal (sem_t *restrict sem, int cancel_oldtype = LIBC_CANCEL_ASYNC(); #if __HAVE_64B_ATOMICS - uint64_t d = atomic_fetch_add_relaxed (&sem->data, + uint64_t d = atomic_fetch_add_relaxed (&isem->data, (uint64_t) 1 << SEM_NWAITERS_SHIFT); pthread_cleanup_push (__sem_wait_cleanup, isem); @@ -72,11 +72,11 @@ __sem_timedwait_internal (sem_t *restrict sem, /* No token, sleep. */ if (timeout) err = __lll_abstimed_wait_intr ( - ((unsigned int *) &sem->data) + SEM_VALUE_OFFSET, + ((unsigned int *) &isem->data) + SEM_VALUE_OFFSET, 0, timeout, flags, clock_id); else err = __lll_wait_intr ( - ((unsigned int *) &sem->data) + SEM_VALUE_OFFSET, + ((unsigned int *) &isem->data) + SEM_VALUE_OFFSET, 0, flags); if (err != 0 && err != KERN_INVALID_ARGUMENT) @@ -92,12 +92,12 @@ __sem_timedwait_internal (sem_t *restrict sem, } /* Token changed */ - d = atomic_load_relaxed (&sem->data); + d = atomic_load_relaxed (&isem->data); } else { /* Try to acquire and dequeue. */ - if (atomic_compare_exchange_weak_acquire (&sem->data, + if (atomic_compare_exchange_weak_acquire (&isem->data, &d, d - 1 - ((uint64_t) 1 << SEM_NWAITERS_SHIFT))) { /* Success */ |