diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2008-08-02 20:40:14 +0000 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2008-08-02 20:40:14 +0000 |
commit | 65384669214e2025f8d6aa99f5dad71a96f08ac0 (patch) | |
tree | c89b4fd309634801bedce9a3df7588008efa72aa | |
parent | 9a5c2e448de0531aa59f909667b9b55cc9d66c4c (diff) |
2008-08-02 Samuel Thibault <samuel.thibault@ens-lyon.org>
[libpthread]
* sysdeps/i386/bits/memory.h (__memory_barrier): Add memory clobber.
* sysdeps/i386/bits/spin-lock.h (__pthread_spin_trylock,
__pthread_spin_unlock): Add memory clobbers.
[libthreads]
* i386/cthreads.h (spin_unlock, spin_try_lock): Add memory clobbers.
-rw-r--r-- | sysdeps/i386/bits/memory.h | 2 | ||||
-rw-r--r-- | sysdeps/i386/bits/spin-lock.h | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/sysdeps/i386/bits/memory.h b/sysdeps/i386/bits/memory.h index e47a8e2d..932c4086 100644 --- a/sysdeps/i386/bits/memory.h +++ b/sysdeps/i386/bits/memory.h @@ -28,7 +28,7 @@ __memory_barrier (void) /* Any lock'ed instruction will do. We just do a simple increment. */ - __asm__ __volatile ("lock; incl %0" : "=m" (i) : "m" (i)); + __asm__ __volatile ("lock; incl %0" : "=m" (i) : "m" (i) : "memory"); } /* Prevent read reordering across this function. */ diff --git a/sysdeps/i386/bits/spin-lock.h b/sysdeps/i386/bits/spin-lock.h index 30b0c64b..a3066979 100644 --- a/sysdeps/i386/bits/spin-lock.h +++ b/sysdeps/i386/bits/spin-lock.h @@ -70,7 +70,7 @@ __pthread_spin_trylock (__pthread_spinlock_t *__lock) { int __locked; __asm__ __volatile ("xchgl %0, %1" - : "=&r" (__locked), "=m" (*__lock) : "0" (1)); + : "=&r" (__locked), "=m" (*__lock) : "0" (1) : "memory"); return __locked ? __EBUSY : 0; } @@ -92,7 +92,7 @@ __pthread_spin_unlock (__pthread_spinlock_t *__lock) { int __unlocked; __asm__ __volatile ("xchgl %0, %1" - : "=&r" (__unlocked), "=m" (*__lock) : "0" (0)); + : "=&r" (__unlocked), "=m" (*__lock) : "0" (0) : "memory"); return 0; } |