about summary refs log tree commit diff
path: root/linuxthreads
diff options
context:
space:
mode:
Diffstat (limited to 'linuxthreads')
-rw-r--r--linuxthreads/ChangeLog10
-rw-r--r--linuxthreads/spinlock.c3
-rw-r--r--linuxthreads/sysdeps/powerpc/pt-machine.h31
3 files changed, 13 insertions, 31 deletions
diff --git a/linuxthreads/ChangeLog b/linuxthreads/ChangeLog
index c89fa758a3..5b4dcbd64a 100644
--- a/linuxthreads/ChangeLog
+++ b/linuxthreads/ChangeLog
@@ -1,3 +1,13 @@
+1998-08-24  Geoff Keating  <geoffk@ozemail.com.au>
+
+	* spinlock.c (__pthread_lock): Reset p_nextwaiting to NULL if it
+	turned out that we didn't need to queue after all.
+
+1998-08-22  Geoff Keating  <geoffk@ozemail.com.au>
+
+	* sysdeps/powerpc/pt-machine.h: Remove testandset, it's not used
+	and wastes space; correct types.
+
 1998-08-08 11:18  H.J. Lu  <hjl@gnu.org>
 
 	* signals.c (sigaction): Handle NULL argument.
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index 2546e2a6e0..8a8d3bfb84 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -47,9 +47,10 @@ void __pthread_lock(struct _pthread_fastlock * lock)
       newstatus = 1;
     } else {
       self = thread_self();
-      self->p_nextwaiting = (pthread_descr) oldstatus;
       newstatus = (long) self;
     }
+    if (self != NULL)
+      self->p_nextwaiting = (pthread_descr) oldstatus;
   } while(! compare_and_swap(&lock->status, oldstatus, newstatus,
                              &lock->spinlock));
   if (oldstatus != 0) suspend(self);
diff --git a/linuxthreads/sysdeps/powerpc/pt-machine.h b/linuxthreads/sysdeps/powerpc/pt-machine.h
index a52af8a7eb..7829c779e6 100644
--- a/linuxthreads/sysdeps/powerpc/pt-machine.h
+++ b/linuxthreads/sysdeps/powerpc/pt-machine.h
@@ -2,7 +2,6 @@
    powerpc version.
    Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
-   Contributed by Richard Henderson <rth@tamu.edu>.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -31,34 +30,6 @@
 #define sync() __asm__ __volatile__ ("sync")
 #endif
 
-/* Spinlock implementation; required.  */
-#if BROKEN_PPC_ASM_CR0
-static
-#else
-extern inline
-#endif
-int
-testandset (int *spinlock)
-{
-  int ret;
-
-  sync();
-  __asm__ __volatile__(
-		       "0:    lwarx %0,0,%1 ;"
-		       "      cmpwi %0,0;"
-		       "      bne 1f;"
-		       "      stwcx. %2,0,%1;"
-		       "      bne- 0b;"
-		       "1:    "
-	: "=&r"(ret)
-	: "r"(spinlock), "r"(1)
-	: "cr0", "memory");
-  sync();
-
-  return ret != 0;
-}
-
-
 /* Get some notion of the current stack.  Need not be exactly the top
    of the stack, just something somewhere in the current frame.  */
 #define CURRENT_STACK_FRAME  stack_pointer
@@ -74,7 +45,7 @@ static
 extern inline
 #endif
 int
-__compare_and_swap (int *p, int oldval, int newval)
+__compare_and_swap (long *p, long oldval, long newval)
 {
   int ret;