Re: Latch implementation that wakes on postmaster death on both win32 and Unix

Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>

From: Heikki Linnakangas <heikki.linnakangas@enterprisedb.com>
To: Peter Geoghegan <peter@2ndquadrant.com>
Cc: PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-06-16T15:30:50Z
Lists: pgsql-hackers
This patch breaks silent_mode=on. In silent_mode, postmaster forks early 
on, to detach from the controlling tty. It uses fork_process() for that, 
which with patch closes the write end of the postmaster-alive pipe, but 
that's wrong because the child becomes the postmaster process.

On a stylistic note, the "extern" declaration in unix_latch.c is ugly, 
extern declarations should be in header files. Come to think of it, I 
feel the Init- and ReleasePostmasterDeathWatchHandle() functions should 
go to postmaster.c. postmaster_alive_fds[] and PostmasterHandle serve 
the same purpose, declaration and initialization of both should be kept 
together, perhaps by moving the initialization of PostmasterHandle into 
Init- and ReleasePostmasterDeathWatchHandle().

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com