pgsql: doc: Expand section related to LWLocks and shared memory - Mailing list pgsql-committers

From Michael Paquier
Subject pgsql: doc: Expand section related to LWLocks and shared memory
Date
Msg-id E1qy4E2-003OJq-Gi@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(+)


pgsql-committers by date:

Previous
From: Bruce Momjian
Date:
Subject: pgsql: doc: add missing word to sentence about Paris
Next
From: Daniel Gustafsson
Date:
Subject: pgsql: Fix function name in comment