Use an shmem_exit callback to remove backend from PMChildFlags on exit
authorHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 8 Oct 2024 12:06:34 +0000 (15:06 +0300)
committerHeikki Linnakangas <heikki.linnakangas@iki.fi>
Tue, 8 Oct 2024 12:06:34 +0000 (15:06 +0300)
commit2bbc261ddbdfee2def5d14ee9fcc09c70bdf84e6
treee163ad3a84702214f2bd678de341b15e612246e4
parent85ec945b7880931cb506392101cb0b00209b78ba
Use an shmem_exit callback to remove backend from PMChildFlags on exit

This seems nicer than having to duplicate the logic between
InitProcess() and ProcKill() for which child processes have a
PMChildFlags slot.

Move the MarkPostmasterChildActive() call earlier in InitProcess(),
out of the section protected by the spinlock.

Reviewed-by: Andres Freund <andres@anarazel.de>
Discussion: https://www.postgresql.org/message-id/a102f15f-eac4-4ff2-af02-f9ff209ec66f@iki.fi
src/backend/storage/ipc/pmsignal.c
src/backend/storage/lmgr/proc.c
src/include/storage/pmsignal.h