Re: SIGPIPE handling, take two. - Mailing list pgsql-patches

From Tom Lane
Subject Re: SIGPIPE handling, take two.
Date
Msg-id 10059.1068571692@sss.pgh.pa.us
Whole thread Raw
In response to Re: SIGPIPE handling, take two.  (Manfred Spraul <manfred@colorfullife.com>)
Responses Re: SIGPIPE handling, take two.
List pgsql-patches
Manfred Spraul <manfred@colorfullife.com> writes:
> What about multithreaded apps?

>   old = pgsignal(SIPEPIPE, SIG_IGN);
>   ** another thread calls sigaction(SIGPIPE,,);
>   pgsignal(SIGPIPE, old);

> And the signal state is corrupted.

If other threads are changing the signal state mid-flight, we are
screwed anyway; if not here then later when we are doing sends,
or even more directly because our test here may not reflect reality
later.

I don't think we need to complicate pqsignal's API for this.  Instead
we'd better document that SIGPIPE handling has to be set up and kept
stable before doing any libpq operations in a multithread app.

            regards, tom lane

pgsql-patches by date:

Previous
From: Manfred Spraul
Date:
Subject: Re: SIGPIPE handling, take two.
Next
From: Manfred Spraul
Date:
Subject: Re: SIGPIPE handling, take two.