From 2b72ebac3fdf9991e797f788b8bf636b9fcb2c7b Mon Sep 17 00:00:00 2001 From: Geoff Keating Date: Mon, 12 Jun 2000 07:00:35 +0000 Subject: * sysdeps/powerpc/pspinlock.c (__pthread_spin_lock): Implement. (__pthread_spin_trylock): Implement. (__pthread_spin_unlock): Implement. (__pthread_spin_init): Implement. (__pthread_spin_destroy): Implement. 2000-06-11 Geoff Keating * sysdeps/powerpc/pspinlock.c (__pthread_spin_lock): Implement. (__pthread_spin_trylock): Implement. (__pthread_spin_unlock): Implement. (__pthread_spin_init): Implement. (__pthread_spin_destroy): Implement. really append the entry. --- linuxthreads/sysdeps/powerpc/pspinlock.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'linuxthreads/sysdeps') diff --git a/linuxthreads/sysdeps/powerpc/pspinlock.c b/linuxthreads/sysdeps/powerpc/pspinlock.c index 6858ee1cf8..77cad0c8af 100644 --- a/linuxthreads/sysdeps/powerpc/pspinlock.c +++ b/linuxthreads/sysdeps/powerpc/pspinlock.c @@ -19,12 +19,15 @@ #include #include +#include int __pthread_spin_lock (pthread_spinlock_t *lock) { - XXX + while (! __compare_and_swap ((long int *)lock, 0, 1)) + ; + return 0; } weak_alias (__pthread_spin_lock, pthread_spin_lock) @@ -32,7 +35,7 @@ weak_alias (__pthread_spin_lock, pthread_spin_lock) int __pthread_spin_trylock (pthread_spinlock_t *lock) { - XXX + return __compare_and_swap ((long int *)lock, 0, 1) ? 0 : EBUSY; } weak_alias (__pthread_spin_trylock, pthread_spin_trylock) @@ -40,7 +43,9 @@ weak_alias (__pthread_spin_trylock, pthread_spin_trylock) int __pthread_spin_unlock (pthread_spinlock_t *lock) { - XXX + MEMORY_BARRIER (); + *lock = 0; + return 0; } weak_alias (__pthread_spin_unlock, pthread_spin_unlock) @@ -51,7 +56,7 @@ __pthread_spin_init (pthread_spinlock_t *lock, int pshared) /* We can ignore the `pshared' parameter. Since we are busy-waiting all processes which can access the memory location `lock' points to can use the spinlock. */ - XXX + *lock = 1; return 0; } weak_alias (__pthread_spin_init, pthread_spin_init) -- cgit 1.4.1