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

From: Andres Freund <andres(at)anarazel(dot)de>
To: Hubert Zhang <hzhang(at)pivotal(dot)io>
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:21:53
Message-ID: 20181017152153.siixalfswysfygn5@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nikolay Shaplov 2018-10-17 15:28:31 Re: pageinspect: add tuple_data_record()
Previous Message Jakob Egger 2018-10-17 15:15:04 Re: PG vs macOS Mojave