about summary refs log tree commit diff
path: root/sysdeps/htl/pt-rwlock-timedwrlock.c
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-10 23:06:33 +0100
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2020-02-11 00:32:44 +0100
commit8ba6ad703cb38ec57cdb473650ac289e5f8496d5 (patch)
tree843104571af29b6872721b6477d3b2e2444a3e96 /sysdeps/htl/pt-rwlock-timedwrlock.c
parentcd7965bd970b0a298e734acc9dafae0a5db5f712 (diff)
downloadglibc-8ba6ad703cb38ec57cdb473650ac289e5f8496d5.tar.gz
glibc-8ba6ad703cb38ec57cdb473650ac289e5f8496d5.tar.xz
glibc-8ba6ad703cb38ec57cdb473650ac289e5f8496d5.zip
hurd: Add __pthread_spin_wait and use it
900778283ac3 ("htl: make pthread_spin_lock really spin") made
pthread_spin_lock really spin and not block, but the current users of
__pthread_spin_lock were assuming that it blocks, i.e. they use it as a
lightweight mutex fitting in just one int.

__pthread_spin_wait provides that support back.
Diffstat (limited to 'sysdeps/htl/pt-rwlock-timedwrlock.c')
-rw-r--r--sysdeps/htl/pt-rwlock-timedwrlock.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/htl/pt-rwlock-timedwrlock.c b/sysdeps/htl/pt-rwlock-timedwrlock.c
index 57c46dccca..d0293c1e96 100644
--- a/sysdeps/htl/pt-rwlock-timedwrlock.c
+++ b/sysdeps/htl/pt-rwlock-timedwrlock.c
@@ -33,7 +33,7 @@ __pthread_rwlock_timedwrlock_internal (struct __pthread_rwlock *rwlock,
   int drain;
   struct __pthread *self;
 
-  __pthread_spin_lock (&rwlock->__lock);
+  __pthread_spin_wait (&rwlock->__lock);
   if (__pthread_spin_trylock (&rwlock->__held) == 0)
     /* Successfully acquired the lock.  */
     {
@@ -65,7 +65,7 @@ __pthread_rwlock_timedwrlock_internal (struct __pthread_rwlock *rwlock,
       __pthread_block (self);
     }
 
-  __pthread_spin_lock (&rwlock->__lock);
+  __pthread_spin_wait (&rwlock->__lock);
   if (self->prevp == NULL)
     /* Another thread removed us from the queue, which means a wakeup message
        has been sent.  It was either consumed while we were blocking, or