From 8ba6ad703cb38ec57cdb473650ac289e5f8496d5 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Mon, 10 Feb 2020 23:06:33 +0100 Subject: 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. --- sysdeps/mach/htl/bits/spin-lock-inline.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'sysdeps/mach/htl/bits/spin-lock-inline.h') diff --git a/sysdeps/mach/htl/bits/spin-lock-inline.h b/sysdeps/mach/htl/bits/spin-lock-inline.h index 556bdd4c28..006b6fd5f2 100644 --- a/sysdeps/mach/htl/bits/spin-lock-inline.h +++ b/sysdeps/mach/htl/bits/spin-lock-inline.h @@ -71,6 +71,15 @@ __pthread_spin_lock (__pthread_spinlock_t *__lock) return 0; } +__PT_SPIN_INLINE int __pthread_spin_wait (__pthread_spinlock_t *__lock); + +__PT_SPIN_INLINE int +__pthread_spin_wait (__pthread_spinlock_t *__lock) +{ + __spin_lock ((__spin_lock_t *) __lock); + return 0; +} + __PT_SPIN_INLINE int __pthread_spin_unlock (__pthread_spinlock_t *__lock); __PT_SPIN_INLINE int -- cgit 1.4.1