pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Michael Paquier <michael@paquier.xyz>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: doc: Expand section related to LWLocks and shared memory
Date: Wed, 01 Nov 2023 05:57:10 +0000
Message-ID: <E1qy4E2-003OJq-Gi@gemulon.postgresql.org> (raw)

doc: Expand section related to LWLocks and shared memory

The documentation includes a section describing how to define custom
LWLocks in extensions using the shmem hooks.  However, it has never
mentioned the second, more flexible method based on the following
routines:
- LWLockNewTrancheId() to allocate a tranche ID.
- LWLockRegisterTranche() to associate a name to a tranche ID.
- LWLockInitialize() to initialize a LWLock with a tranche ID.

autoprewarm.c is the only example of extension in the tree that
allocates a LWLock this way.

This commit adds some documentation about all that.  While on it, a
comment is added about the need of AddinShmemInitLock.  This is required
especially for EXEC_BACKEND builds (aka Windows, normally), as per a
remark from Alexander, because backends can execute shmem initialization
paths concurrently.

Author: Aleksander Alekseev, Michael Paquier
Discussion: https://postgr.es/m/CAJ7c6TPKhFgL+54cdTD9yGpG4+sNcyJ+N1GvQqAxgWENAOa3VA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/fe705ef6fc1d1b4b48aea94a1dd2835a6630dacf

Modified Files
--------------
doc/src/sgml/xfunc.sgml | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)



Message-ID: <E1qy4E2-003OJq-Gi@gemulon.postgresql.org>
Permalink:  ../E1qy4E2-003OJq-Gi@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1qy4E2-003OJq-Gi@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: michael@paquier.xyz, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: doc: Expand section related to LWLocks and shared memory
  In-Reply-To: <E1qy4E2-003OJq-Gi@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox