On Thu, 2005-13-10 at 00:11 -0400, Tom Lane wrote:
> BTW, forgot to reply to this part, but: have at it.
I've committed the attached patch; feel free to improve it if you're not
happy.
-Neil
Index: src/include/storage/spin.h
===================================================================
RCS file: /home/neilc/postgres/cvs_root/pgsql/src/include/storage/spin.h,v
retrieving revision 1.25
diff -c -r1.25 spin.h
*** src/include/storage/spin.h 31 Dec 2004 22:03:42 -0000 1.25
--- src/include/storage/spin.h 13 Oct 2005 06:03:17 -0000
***************
*** 7,27 ****
* The hardware-independent interface to spinlocks is defined by the
* typedef "slock_t" and these macros:
*
! * void SpinLockInit(slock_t *lock)
* Initialize a spinlock (to the unlocked state).
*
! * void SpinLockAcquire(slock_t *lock)
* Acquire a spinlock, waiting if necessary.
* Time out and abort() if unable to acquire the lock in a
* "reasonable" amount of time --- typically ~ 1 minute.
* Cancel/die interrupts are held off until the lock is released.
*
! * void SpinLockRelease(slock_t *lock)
* Unlock a previously acquired lock.
* Release the cancel/die interrupt holdoff.
*
! * void SpinLockAcquire_NoHoldoff(slock_t *lock)
! * void SpinLockRelease_NoHoldoff(slock_t *lock)
* Same as above, except no interrupt holdoff processing is done.
* This pair of macros may be used when there is a surrounding
* interrupt holdoff.
--- 7,27 ----
* The hardware-independent interface to spinlocks is defined by the
* typedef "slock_t" and these macros:
*
! * void SpinLockInit(volatile slock_t *lock)
* Initialize a spinlock (to the unlocked state).
*
! * void SpinLockAcquire(volatile slock_t *lock)
* Acquire a spinlock, waiting if necessary.
* Time out and abort() if unable to acquire the lock in a
* "reasonable" amount of time --- typically ~ 1 minute.
* Cancel/die interrupts are held off until the lock is released.
*
! * void SpinLockRelease(volatile slock_t *lock)
* Unlock a previously acquired lock.
* Release the cancel/die interrupt holdoff.
*
! * void SpinLockAcquire_NoHoldoff(volatile slock_t *lock)
! * void SpinLockRelease_NoHoldoff(volatile slock_t *lock)
* Same as above, except no interrupt holdoff processing is done.
* This pair of macros may be used when there is a surrounding
* interrupt holdoff.
***************
*** 33,39 ****
* Callers must beware that the macro argument may be evaluated multiple
* times!
*
! * The macros are implemented in terms of hardware-dependent macros
* supplied by s_lock.h.
*
*
--- 33,49 ----
* Callers must beware that the macro argument may be evaluated multiple
* times!
*
! * CAUTION: Care must be taken to ensure that loads and stores of
! * shared memory values are not rearranged around spinlock acquire
! * and release. This is done using the "volatile" qualifier: the C
! * standard states that loads and stores of volatile objects cannot
! * be rearranged *with respect to other volatile objects*. The
! * spinlock is always written through a volatile pointer by the
! * spinlock macros, but this is not sufficient by itself: code that
! * protects shared data with a spinlock MUST reference that shared
! * data through a volatile pointer.
! *
! * These macros are implemented in terms of hardware-dependent macros
* supplied by s_lock.h.
*
*
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match