aboutsummaryrefslogtreecommitdiff
path: root/linuxthreads/spinlock.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-18 17:18:38 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-18 17:18:38 +0000
commite6574c9ca263afb7d408dd5ebf09ad8cb0178469 (patch)
tree8c9059f8900b7ff3c761f462d534f20c89930564 /linuxthreads/spinlock.c
parente862aada834365440fc500cb463f2c62edb6142f (diff)
downloadglibc-e6574c9ca263afb7d408dd5ebf09ad8cb0178469.zip
glibc-e6574c9ca263afb7d408dd5ebf09ad8cb0178469.tar.gz
glibc-e6574c9ca263afb7d408dd5ebf09ad8cb0178469.tar.bz2
Update.
2000-07-18 Kaz Kylheku <kaz@ashi.footprints.net> * spinlock.c (__pthread_alt_lock, __pthread_alt_timedlock): Fixed bug whereby thr field of waitnode structure would not be correctly set unless a null self pointer is passed to the functions. Eliminated redundant calls to thread_self().
Diffstat (limited to 'linuxthreads/spinlock.c')
-rw-r--r--linuxthreads/spinlock.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index 38d6b8e..43190a2 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -345,7 +345,7 @@ static void wait_node_dequeue(struct wait_node **pp_head,
if (pp_node == pp_head) {
long oldvalue = (long) p_node;
long newvalue = (long) p_node->next;
-
+
if (__compare_and_swap((long *) pp_node, oldvalue, newvalue))
return;
@@ -388,7 +388,7 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock,
wait_node.abandoned = 0;
wait_node.next = (struct wait_node *) lock->__status;
- wait_node.thr = self = thread_self();
+ wait_node.thr = self;
suspend_needed = 1;
}
@@ -408,7 +408,8 @@ void __pthread_alt_lock(struct _pthread_fastlock * lock,
newstatus = 1;
} else {
if (self == NULL)
- wait_node.thr = self = thread_self();
+ self = thread_self();
+ wait_node.thr = self;
newstatus = (long) &wait_node;
}
wait_node.abandoned = 0;
@@ -461,7 +462,7 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
p_wait_node->abandoned = 0;
p_wait_node->next = (struct wait_node *) lock->__status;
- p_wait_node->thr = self = thread_self();
+ p_wait_node->thr = self;
}
WRITE_MEMORY_BARRIER();
@@ -478,7 +479,7 @@ int __pthread_alt_timedlock(struct _pthread_fastlock * lock,
newstatus = 1;
} else {
if (self == NULL)
- p_wait_node->thr = self = thread_self();
+ p_wait_node->thr = self;
newstatus = (long) p_wait_node;
}
p_wait_node->abandoned = 0;