summaryrefslogtreecommitdiff
path: root/linuxthreads/spinlock.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-30 02:13:26 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-30 02:13:26 +0000
commit746802f20fae7bd377ce5d7aa9114357af48e178 (patch)
treef8e4c7456aedf677054c4491264435137daa0d64 /linuxthreads/spinlock.c
parent6c3ebebd1eddb7041248125fa5e228380400c436 (diff)
Update.
2001-08-29 Ulrich Drepper <drepper@redhat.com> * spinlock.c (__pthread_lock): Top max_count value with MAX_ADAPTIVE_SPIN_COUNT. * internals.h (MAX_ADAPTIVE_SPIN_COUNT): Define if not already done. * sysdeps/i386/i686/pt-machine.h (BUSY_WAIT_NOP): New macro to help P4.
Diffstat (limited to 'linuxthreads/spinlock.c')
-rw-r--r--linuxthreads/spinlock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c
index 199386a4fc..3e16825997 100644
--- a/linuxthreads/spinlock.c
+++ b/linuxthreads/spinlock.c
@@ -94,6 +94,9 @@ again:
if (__pthread_smp_kernel) {
int max_count = lock->__spinlock * 2 + 10;
+ if (max_count > MAX_ADAPTIVE_SPIN_COUNT)
+ max_count = MAX_ADAPTIVE_SPIN_COUNT;
+
for (spin_count = 0; spin_count < max_count; spin_count++) {
if (((oldstatus = lock->__status) & 1) == 0) {
if(__compare_and_swap(&lock->__status, oldstatus, oldstatus | 1))
@@ -104,6 +107,9 @@ again:
return;
}
}
+#ifdef BUSY_WAIT_NOP
+ BUSY_WAIT_NOP;
+#endif
__asm __volatile ("" : "=m" (lock->__status) : "0" (lock->__status));
}