aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/spinlock.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1998-10-27 14:19:07 +0000
committerUlrich Drepper <drepper@redhat.com>1998-10-27 14:19:07 +0000
commitc70ca1fa69c9a95108664b4132b7188a686cc9e4 (patch)
tree19fa3a22f0ab1ce323bb2bfd787ffc86627196be /linuxthreads/spinlock.c
parent91cc83ff9745491a0d6673f36df9cdabd397d748 (diff)
downloadglibc-c70ca1fa69c9a95108664b4132b7188a686cc9e4.zip
glibc-c70ca1fa69c9a95108664b4132b7188a686cc9e4.tar.gz
glibc-c70ca1fa69c9a95108664b4132b7188a686cc9e4.tar.bz2
Update.
* sysdeps/unix/sysv/linux/powerpc/pread.c: Do not use the i386 version. Instead call the system call wrapper function using an 64bit argument. * sysdeps/unix/sysv/linux/powerpc/pread64.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/pwrite.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/pwrite64.c: Likewise.
Diffstat (limited to 'linuxthreads/spinlock.c')
-rw-r--r--linuxthreads/spinlock.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index 15faec0..172cb7a 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -42,7 +42,7 @@ void __pthread_lock(struct _pthread_fastlock * lock)
pthread_descr self = NULL;
do {
- oldstatus = lock->status;
+ oldstatus = lock->__status;
if (oldstatus == 0) {
newstatus = 1;
} else {
@@ -51,8 +51,8 @@ void __pthread_lock(struct _pthread_fastlock * lock)
}
if (self != NULL)
THREAD_SETMEM(self, p_nextwaiting, (pthread_descr) oldstatus);
- } while(! compare_and_swap(&lock->status, oldstatus, newstatus,
- &lock->spinlock));
+ } while(! compare_and_swap(&lock->__status, oldstatus, newstatus,
+ &lock->__spinlock));
if (oldstatus != 0) suspend(self);
}
@@ -61,9 +61,9 @@ int __pthread_trylock(struct _pthread_fastlock * lock)
long oldstatus;
do {
- oldstatus = lock->status;
+ oldstatus = lock->__status;
if (oldstatus != 0) return EBUSY;
- } while(! compare_and_swap(&lock->status, 0, 1, &lock->spinlock));
+ } while(! compare_and_swap(&lock->__status, 0, 1, &lock->__spinlock));
return 0;
}
@@ -74,14 +74,15 @@ void __pthread_unlock(struct _pthread_fastlock * lock)
int maxprio;
again:
- oldstatus = lock->status;
+ oldstatus = lock->__status;
if (oldstatus == 1) {
/* No threads are waiting for this lock */
- if (! compare_and_swap(&lock->status, 1, 0, &lock->spinlock)) goto again;
+ if (! compare_and_swap(&lock->__status, 1, 0, &lock->__spinlock))
+ goto again;
return;
}
/* Find thread in waiting queue with maximal priority */
- ptr = (pthread_descr *) &lock->status;
+ ptr = (pthread_descr *) &lock->__status;
thr = (pthread_descr) oldstatus;
maxprio = 0;
maxptr = ptr;
@@ -94,13 +95,13 @@ again:
thr = *ptr;
}
/* Remove max prio thread from waiting list. */
- if (maxptr == (pthread_descr *) &lock->status) {
+ if (maxptr == (pthread_descr *) &lock->__status) {
/* If max prio thread is at head, remove it with compare-and-swap
to guard against concurrent lock operation */
thr = (pthread_descr) oldstatus;
- if (! compare_and_swap(&lock->status,
+ if (! compare_and_swap(&lock->__status,
oldstatus, (long)(thr->p_nextwaiting),
- &lock->spinlock))
+ &lock->__spinlock))
goto again;
} else {
/* No risk of concurrent access, remove max prio thread normally */