Re: Possible substitute for PostmasterIsAlive polling loops

Поиск
Список
Период
Сортировка
От Florian Pflug
Тема Re: Possible substitute for PostmasterIsAlive polling loops
Дата
Msg-id 06DE5845-AF8A-465F-A903-6DEBD986F249@phlo.org
обсуждение исходный текст
Ответ на Re: Possible substitute for PostmasterIsAlive polling loops  (Robert Haas <robertmhaas@gmail.com>)
Список pgsql-hackers
On Feb24, 2011, at 04:14 , Robert Haas wrote:
> On Wed, Feb 23, 2011 at 4:54 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> IOW, at least on Linux, you *can* arrange to get a signal when your
>> parent process dies.
> 
> That's pretty cool.
> 
>> Not sure how ugly it'd be to use this call when available and a time
>> delay when not, but it's something to think about.
> 
> Yeah.  It may be worth thinking about whether we want to use the
> postmaster-pipe trick someone was proposing.  That might be more
> portable.


FWIW, I did some experiments which this when it was discussion a while ago.

To actually get a signal when the parent dies, I set the FASYNC flag
on the pipe's receiving end's fd. To be able to signal multiple children
using only one pipe, I set the fd's owner to -getgrp() using
fcntl(F_SETOWN). On both linux and OSX 10.6 this caused SIGIO to be sent
to all processes in the process group once sending end of the pipe was
closed.

I don't have access to any other Unixes to test this on, but I since it
works on OSX chances are high that it'll work on FreeBSD also.

best regards,
Florian Pflug



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Marko Tiikkaja
Дата:
Сообщение: Re: wCTE: about the name of the feature
Следующее
От: Tom Lane
Дата:
Сообщение: Re: wCTE: about the name of the feature