Re: kill -KILL: What happens?

Tom Lane <tgl@sss.pgh.pa.us>

From: Tom Lane <tgl@sss.pgh.pa.us>
To: Aidan Van Dyk <aidan@highrise.ca>
Cc: Robert Haas <robertmhaas@gmail.com>, Florian Pflug <fgp@phlo.org>, David Fetter <david@fetter.org>, PG Hackers <pgsql-hackers@postgresql.org>
Date: 2011-01-13T20:42:36Z
Lists: pgsql-hackers
Aidan Van Dyk <aidan@highrise.ca> writes:
> If postmaster has a few fds to spare, what about having it open a pipe
> to every child it spawns.  It never has to read/write to it, but
> postmaster closing will signal the client's fd.  The client just has
> to pop the fd into whatever nrmal poll/select event handlign it uses
> to notice when the "parent's pipe" is closed.

Hmm.  Or more generally: there's one FIFO.  The postmaster holds both
sides open.  Backends hold the write side open.  (They can close the
read side, but that would just be to free up a FD.)  Background children
close the write side.  Now a background process can use EOF on the read
side of the FIFO to tell it that postmaster and all backends have
exited.  You still don't get a signal, but at least the condition you're
testing for is the one we actually want and not an approximation.

			regards, tom lane