From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Andres Freund <andres(at)2ndquadrant(dot)com> |
Cc: | Markus Wanner <markus(at)bluegap(dot)ch>, kaigai(at)kaigai(dot)gr(dot)jp, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Review: Extra Daemons / bgworker |
Date: | 2012-12-05 21:42:42 |
Message-ID: | 20121205214242.GG4673@alvh.no-ip.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Andres Freund wrote:
> On 2012-12-05 12:09:58 -0300, Alvaro Herrera wrote:
> > Here's a first attempt at a new documentation chapter. This goes in
> > part "Server Programming", just after the SPI chapter.
> >
> > I just noticed that worker_spi could use some more sample code, for
> > example auth_counter was getting its own LWLock and also its own shmem
> > area, which would be helpful to demonstrate I think.
>
> I am not exactly renowned for my english skills, but I have made a pass
> over the file made some slight changes and extended it in two places.
Thanks, I have applied it.
> I've also added a comment with a question that came to my mind when
> reading the docs...
> <para>
> <structfield>bgw_sighup</structfield> and <structfield>bgw_sigterm</> are
> pointers to functions that will be installed as signal handlers for the new
> - process.
> + process. XXX: Can they be NULL?
> </para>
Hm. The code doesn't check, so what happens is probably a bug anyhow.
I don't know whether sigaction crashes in this case; its manpage doesn't
say. I guess the right thing to do is have RegisterBackgroundWorker
check for a NULL sighandler, and set it to something standard if so (say
SIG_IGN for SIGHUP and maybe quickdie() or similar for SIGTERM).
--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services
From | Date | Subject | |
---|---|---|---|
Next Message | Simon Riggs | 2012-12-05 21:46:03 | Re: Review: Extra Daemons / bgworker |
Previous Message | Tom Lane | 2012-12-05 21:42:38 | Re: Dumping an Extension's Script |