(__pthread_lock): Reset p_nextwaiting to NULL if it turned out that we
authordrepper <drepper>
Mon, 24 Aug 1998 16:36:08 +0000 (16:36 +0000)
committerdrepper <drepper>
Mon, 24 Aug 1998 16:36:08 +0000 (16:36 +0000)
didn't need to queue after all.

linuxthreads/spinlock.c

index 2546e2a..8a8d3bf 100644 (file)
@@ -47,9 +47,10 @@ void __pthread_lock(struct _pthread_fastlock * lock)
       newstatus = 1;
     } else {
       self = thread_self();
       newstatus = 1;
     } else {
       self = thread_self();
-      self->p_nextwaiting = (pthread_descr) oldstatus;
       newstatus = (long) self;
     }
       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);
   } while(! compare_and_swap(&lock->status, oldstatus, newstatus,
                              &lock->spinlock));
   if (oldstatus != 0) suspend(self);