Re: Is there any way to request unique lwlock inside a background worker in PG9.4?

From: Hubert Zhang <hzhang(at)pivotal(dot)io>
To: andres(at)anarazel(dot)de
Cc: amit(dot)kapila16(at)gmail(dot)com, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Is there any way to request unique lwlock inside a background worker in PG9.4?
Date: 2018-10-17 15:35:54
Message-ID: CAB0yrenA9OAdV=hFdaRcaaAriaL+iB8AoGxRA62zNxknPnHD+w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Thanks a lot.

On Wed, Oct 17, 2018 at 11:21 PM Andres Freund <andres(at)anarazel(dot)de> wrote:

> Hi,
>
> On 2018-10-17 23:11:26 +0800, Hubert Zhang wrote:
> > The section "Share Memory and LWLocks" describe the AddinShmemInitLock
> which
> > is used to protect the ShmemInitStruct() when backend workers initialize
> > their shm. My requirement is to how to protect the shm access within the
> > bgworkers(not at init stage). This lock should be bgworkers specific.
>
> Rereead the page please. After you RequestAddinLWLocks() during
> initialization, you can use LWLockAssign() to get an lwlock. Which you
> then can use as is your pleasure.
>
> Greetings,
>
> Andres Freund
>

--
Thanks

Hubert Zhang

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2018-10-17 15:49:44 Re: [RFC] Removing "magic" oids
Previous Message Nikolay Shaplov 2018-10-17 15:28:31 Re: pageinspect: add tuple_data_record()