Re: Bug in signal handler

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Douglas McNaught <doug(at)mcnaught(dot)org>
Cc: Zdenek Kotala <zdenek(dot)kotala(at)sun(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Bug in signal handler
Date: 2006-05-11 14:03:16
Message-ID: 20060511140316.GG30113@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 11, 2006 at 08:24:02AM -0400, Douglas McNaught wrote:
> Martijn van Oosterhout <kleptog(at)svana(dot)org> writes:
>
> > Running unsafe functions within a signal handler is not unsafe per-se.
> > It's only unsafe if the main program could also be running unsafe
> > functions.
>
> I don't disagree with your reasoning, but does POSIX actually say
> this?

On my machine, signal(2) has the following:

The routine handler must be very careful, since processing
elsewhere was interrupted at some arbitrary point. POSIX has the
concept of "safe function". If a signal interrupts an unsafe
function, and handler calls an unsafe function, then the
behavior is undefined. Safe functions are listed explicitly in
the various standards. The POSIX 1003.1-2003 list is

<long list including select(), signal() and sigaction()>

I havn't read POSIX myself though...

Have a nice day,
--
Martijn van Oosterhout <kleptog(at)svana(dot)org> http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-05-11 14:11:00 Re: Bug in signal handler
Previous Message Mark Campbell 2006-05-11 14:00:30 Compiling on 8.1.3 on Openserver 5.05