On Wed, Oct 03, 2012 at 01:57:47PM -0400, Bruce Momjian wrote:
> On Wed, Oct  3, 2012 at 01:53:28PM -0400, Tom Lane wrote:
> > Bruce Momjian <br...@momjian.us> writes:
> > > Yes, but those framework libraries are typically supposed to prevent
> > > such problems from being seen by applications calling them.
> > 
> > How exactly would a library prevent such problems?  In particular,
> > let's see a proposal for how libpq might make it look like a fork
> > was transparent for an open connection.
> 
> I guess that is impossible.

Well, not quite impossible. A simple solution would be to use
pthread_atfork() to register a handler that puts the socket into an
invalid state in either the parent or the child.

http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_atfork.html

Ofcourse, the backward compatabilty issues prevent us doing that, but
it's *possible*.

Have a nice day,
-- 
Martijn van Oosterhout   <klep...@svana.org>   http://svana.org/kleptog/
> He who writes carelessly confesses thereby at the very outset that he does
> not attach much importance to his own thoughts.
   -- Arthur Schopenhauer

Attachment: signature.asc
Description: Digital signature

Reply via email to