

> You have broken stuff before by rearranging the sequence of
operations... 

Ah, yeah, well, FWIW, if that is the only thing that gets broken in the
process of making this port, I'll be more than satisfied. Will that be held
against me forever?


> what exactly have you got in mind here?

Moving InitShmemIndex into InitShmemAllocation. 

I'd like to make this the first call, inside the context of ShmemBootstrap =
true, and insert logic to avoid SpinLock acquisition/release inside
ShmemAlloc/ShmemInitStruct (when ShmemBootstrap = true). Not pretty, but
I'll trade off the removal of other ugliness (like the
ShmemLock/ShmemIndexLock spinlock memory allocation, which could then just
use ShmemAlloc).


> > ... a possible solution to a Win32 shmem/semaphore bootstrap
> > problem (postgres semaphores under Win32 uses ShmemIndex which uses
> > spinlocks which use shared memory which use semaphores which ...).

> The correct solution to that seems to lie elsewhere, ie, not use
semaphores for spinlocks.

Just working with what we've already got. There seems to be very usable code
in src/backend/port/win32/sema.c, which gets invoked as Win32 does not have
spin-locks, but unfortunately relies on ShmemInitStruct.

If you've got a shorter path in mind, I'm all ears.

Cheers,
Claudio

--- 
Certain disclaimers and policies apply to all email sent from Memetrics.
For the full text of these disclaimers and policies see 
<a
href="http://www.memetrics.com/emailpolicy.html">http://www.memetrics.com/em
ailpolicy.html</a>

Tue, 13 Jan 2004 11:11:29 +1100
Claudio Natoli <claudio.natoli@memetrics.com>
Re: LWLock/ShmemIndex startup question 
Claudio Natoli <claudio.natoli@memetrics.com> writes:
>> The correct solution to that seems to lie elsewhere, ie, not use
>> semaphores for spinlocks.

> Just working with what we've already got. There seems to be very usable code
> in src/backend/port/win32/sema.c, which gets invoked as Win32 does not have
> spin-locks, but unfortunately relies on ShmemInitStruct.

Win32 certainly has spinlocks; it does not run on any hardware for which
we don't have spinlock assembler.  For that matter, doesn't it have
POSIX-compatible semaphores?  I'm not sure there's any need for
src/backend/port/win32/sema.c at all.

			regards, tom lane

Mon, 12 Jan 2004 23:46:40 -0500
Tom Lane <tgl@sss.pgh.pa.us>
Re: LWLock/ShmemIndex startup question 