*** postgresql-8.0.3/src/include/storage/s_lock.h.orig Sun Aug 28 20:41:44 2005 --- postgresql-8.0.3/src/include/storage/s_lock.h Fri Sep 9 14:58:44 2005 *************** *** 120,132 **** { register slock_t _res = 1; ! /* Use a non-locking test before asserting the bus lock */ __asm__ __volatile__( - " cmpb $0,%1 \n" - " jne 1f \n" - " lock \n" " xchgb %0,%1 \n" - "1: \n" : "+q"(_res), "+m"(*lock) : : "memory", "cc"); --- 120,128 ---- { register slock_t _res = 1; ! /* xchg implies a LOCK prefix, so no need to say LOCK explicitly */ __asm__ __volatile__( " xchgb %0,%1 \n" : "+q"(_res), "+m"(*lock) : : "memory", "cc"); *** postgresql-8.0.3/src/backend/storage/lmgr/s_lock.c.orig Fri Aug 26 10:47:35 2005 --- postgresql-8.0.3/src/backend/storage/lmgr/s_lock.c Sat Sep 10 19:19:46 2005 *************** *** 17,22 **** --- 17,23 ---- #include #include + #include #include "storage/s_lock.h" #include "miscadmin.h" *************** *** 83,89 **** int spins = 0; int delays = 0; ! int cur_delay = MIN_DELAY_CSEC; while (TAS(lock)) { --- 84,90 ---- int spins = 0; int delays = 0; ! int cur_delay = 0; while (TAS(lock)) { *************** *** 96,102 **** if (++delays > NUM_DELAYS) s_lock_stuck(lock, file, line); ! pg_usleep(cur_delay * 10000L); #if defined(S_LOCK_TEST) fprintf(stdout, "*"); --- 97,110 ---- if (++delays > NUM_DELAYS) s_lock_stuck(lock, file, line); ! if (cur_delay == 0) ! { ! /* first time through, try just a sched_yield */ ! sched_yield(); ! cur_delay = MIN_DELAY_CSEC; ! } ! else ! pg_usleep(cur_delay * 10000L); #if defined(S_LOCK_TEST) fprintf(stdout, "*");