aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn David Anglin <dave.anglin@bell.net>2014-08-10 09:54:53 -0400
committerMike Frysinger <vapier@gentoo.org>2015-08-05 06:44:54 -0400
commit8175e9150a768a1eb135347bdb40b8161cb872dc (patch)
treed13db2db78335f4733c172ff938c2634cca22ee2
parent6fef29c020d055f994cf7c4602b01a553b7a9860 (diff)
downloadglibc-8175e9150a768a1eb135347bdb40b8161cb872dc.tar
glibc-8175e9150a768a1eb135347bdb40b8161cb872dc.tar.gz
glibc-8175e9150a768a1eb135347bdb40b8161cb872dc.tar.bz2
glibc-8175e9150a768a1eb135347bdb40b8161cb872dc.zip
hppa: fix pthread spinlock
-rw-r--r--sysdeps/hppa/nptl/pthread_spin_init.c8
-rw-r--r--sysdeps/hppa/nptl/pthread_spin_unlock.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/sysdeps/hppa/nptl/pthread_spin_init.c b/sysdeps/hppa/nptl/pthread_spin_init.c
index 865ef2bfac..a49a8468ca 100644
--- a/sysdeps/hppa/nptl/pthread_spin_init.c
+++ b/sysdeps/hppa/nptl/pthread_spin_init.c
@@ -20,9 +20,9 @@
int
pthread_spin_init (pthread_spinlock_t *lock, int pshared)
{
- int tmp = 0;
- /* This should be a memory barrier to newer compilers */
- __asm__ __volatile__ ("stw,ma %1,0(%0)"
- : : "r" (lock), "r" (tmp) : "memory");
+ /* The LWS-CAS operation on hppa is a synthetic atomic operation
+ that doesn't provide the type of coherency that we need. Therefore
+ we force that coherency by using LWS-CAS again. */
+ atomic_exchange_rel (lock, 0);
return 0;
}
diff --git a/sysdeps/hppa/nptl/pthread_spin_unlock.c b/sysdeps/hppa/nptl/pthread_spin_unlock.c
index a183fed35e..b576649d2a 100644
--- a/sysdeps/hppa/nptl/pthread_spin_unlock.c
+++ b/sysdeps/hppa/nptl/pthread_spin_unlock.c
@@ -20,9 +20,9 @@
int
pthread_spin_unlock (pthread_spinlock_t *lock)
{
- int tmp = 0;
- /* This should be a memory barrier to newer compilers */
- __asm__ __volatile__ ("stw,ma %1,0(%0)"
- : : "r" (lock), "r" (tmp) : "memory");
+ /* The LWS-CAS operation on hppa is a synthetic atomic operation
+ that doesn't provide the type of coherency that we need. Therefore
+ we force that coherency by using LWS-CAS again. */
+ atomic_exchange_rel (lock, 0);
return 0;
}