Make LWLockCounter a global variable. Using the LWLockCounter requires first calculating its address in shared memory like this:
LWLockCounter = (int *) ((char *) MainLWLockArray - sizeof(int)); Commit 82e861fbe1 started this trend in order to fix EXEC_BACKEND builds, but it could also be fixed by adding it to the BackendParameters struct. The current approach is somewhat difficult to follow, so this commit switches to the latter. While at it, swap around the code in LWLockShmemSize() to match the order of assignments in CreateLWLocks() for added readability. Reviewed-by: Tom Lane <t...@sss.pgh.pa.us> Reviewed-by: Bertrand Drouvot <bertranddrouvot...@gmail.com> Discussion: https://postgr.es/m/aLDLnan9gNCS9fHx%40nathan Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/67fcf48c3bb3cc3cf51788332701ffb694fb108b Modified Files -------------- src/backend/postmaster/launch_backend.c | 3 +++ src/backend/storage/lmgr/lwlock.c | 24 ++++++++---------------- src/include/storage/lwlock.h | 1 + 3 files changed, 12 insertions(+), 16 deletions(-)