From c5e340c71ba6f4563ca5fa245baa82b6363ddb2e Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 29 Oct 1998 15:17:25 +0000 Subject: Update. 1998-10-29 Ulrich Drepper * sysdeps/unix/sysv/linux/ttyname_r.c (ttyname_r): Try reading /prof/self/fd/FD first. * sysdeps/unix/sysv/linux/ttyname.c (ttyname): Likewise. * stdio-common/_itoa.h (_fitoa_word): New inline function. Write formatted number starting at given position and return pointer to following byte. (_fitoa): Likewise, for long long. --- linuxthreads/spinlock.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'linuxthreads/spinlock.c') diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c index 172cb7afe4..00a8691e5b 100644 --- a/linuxthreads/spinlock.c +++ b/linuxthreads/spinlock.c @@ -36,17 +36,18 @@ This is safe because there are no concurrent __pthread_unlock operations -- only the thread that locked the mutex can unlock it. */ -void __pthread_lock(struct _pthread_fastlock * lock) +void internal_function __pthread_lock(struct _pthread_fastlock * lock, + pthread_descr self) { long oldstatus, newstatus; - pthread_descr self = NULL; do { oldstatus = lock->__status; if (oldstatus == 0) { newstatus = 1; } else { - self = thread_self(); + if (self == NULL) + self = thread_self(); newstatus = (long) self; } if (self != NULL) @@ -56,18 +57,7 @@ void __pthread_lock(struct _pthread_fastlock * lock) if (oldstatus != 0) suspend(self); } -int __pthread_trylock(struct _pthread_fastlock * lock) -{ - long oldstatus; - - do { - oldstatus = lock->__status; - if (oldstatus != 0) return EBUSY; - } while(! compare_and_swap(&lock->__status, 0, 1, &lock->__spinlock)); - return 0; -} - -void __pthread_unlock(struct _pthread_fastlock * lock) +void internal_function __pthread_unlock(struct _pthread_fastlock * lock) { long oldstatus; pthread_descr thr, * ptr, * maxptr; -- cgit v1.2.3