From 746802f20fae7bd377ce5d7aa9114357af48e178 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 30 Aug 2001 02:13:26 +0000 Subject: Update. 2001-08-29 Ulrich Drepper * 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. --- linuxthreads/spinlock.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'linuxthreads/spinlock.c') diff --git a/linuxthreads/spinlock.c b/linuxthreads/spinlock.c index 199386a..3e16825 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)); } -- cgit v1.1