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