Re: LWLock/ShmemIndex startup question - Mailing list pgsql-hackers

From Tom Lane
Subject Re: LWLock/ShmemIndex startup question
Date
Msg-id 11176.1074005663@sss.pgh.pa.us
Whole thread Raw
In response to Re: LWLock/ShmemIndex startup question  (Claudio Natoli <claudio.natoli@memetrics.com>)
List pgsql-hackers
Claudio Natoli <claudio.natoli@memetrics.com> writes:
> FWIW, I've done a code walk-through, and it looks ok (lack of real-world
> testing notwithstanding), and actually does use the Win32 sema set. The only
> real problem is that it calls ShmemInitStruct in semget, which ultimately
> gets us into bootstrap hell (without native spinlocks, at least).

Right.  The advantage of the pg_sema.h API is that you don't need any
shared control data.  Take a close look at the way posix_sema works:
the management information needed to release the semas at shutdown is
private to the postmaster.  What is in shared memory need only be a
reference or token (whatever you have to hand to the lock/unlock calls).
Also, allocation of the shmem space is not the responsibility of the
startup routine.  So all these issues go away as long as you're not
trying to emulate the SysV interface.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Merlin Moncure"
Date:
Subject: Re: [pgsql-hackers-win32] Win32 signal code - first try
Next
From: Tom Lane
Date:
Subject: Re: LWLock/ShmemIndex startup question