Re: Latches API on windows

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org,Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>,Craig Ringer <craig(at)2ndquadrant(dot)com>
Cc: Abbas Butt <abbas(dot)butt(at)enterprisedb(dot)com>,PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>,Marc Linster <marc(dot)linster(at)enterprisedb(dot)com>,"A(dot) Hayee" <hayee(dot)bhatti(at)enterprisedb(dot)com>,Hope Jiang <hope(dot)jiang(at)enterprisedb(dot)com>,Priti Sarode <priti(dot)sarode(at)enterprisedb(dot)com>,Ahsan Hadi <ahsan(dot)hadi(at)enterprisedb(dot)com>
Subject: Re: Latches API on windows
Date: 2017-10-09 14:00:01
Message-ID: A8D2A789-3BA5-4AEB-9235-C3232BA3FBFD@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On October 9, 2017 6:56:10 AM PDT, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>Craig Ringer <craig(at)2ndquadrant(dot)com> writes:
>> On 9 October 2017 at 21:26, Abbas Butt <abbas(dot)butt(at)enterprisedb(dot)com>
>wrote:
>>> In my case this is not true, I am calling InitSharedLatch in
>_PG_init
>>> which gets called at CREATE EXTENSION time.
>>> My question : Is there a way to get the latches API work on windows
>>> the way it is working on Linux?
>
>> I suspect you'd need to do it by having your extension load via
>> shared_preload_libraries, registering its latch in shmem_startup_hook
>
>Yeah. That would also let you request your shared memory area
>honestly,
>instead of relying on there being some slop in the initial allocation.

Might be dsm style memory.

I think the right approach here, regardless of the source of the memory, is to actually bit create a new latch, but instead to store a pointer the the owning processes preexisting latch. Besides solving this issue, it also avoids problems with various routines already waiting on the proclatch.

Andres

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ants Aasma 2017-10-09 14:08:05 Re: Discussion on missing optimizations
Previous Message Abbas Butt 2017-10-09 13:59:38 Re: Latches API on windows