Re: libpq and psql not on same page about SIGPIPE

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Manfred Spraul <manfred(at)colorfullife(dot)com>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: libpq and psql not on same page about SIGPIPE
Date: 2004-12-02 15:50:07
Message-ID: 8179.1102002607@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

Manfred Spraul <manfred(at)colorfullife(dot)com> writes:
> Tom Lane wrote:
>> Not really: it only solves the problem *if you change the application*,
>> which is IMHO not acceptable.

> No. non-threaded apps do not need to change. The default is the old, 7.3
> code: change the signal handler around the write calls. Which means that
> non-threaded apps are guaranteed to work without any changes, regardless
> of the libpq thread safety setting.

Hmm, so you propose that a thread-enabled library must contain both code
paths and choose between them on the fly? That seems like the worst of
all possible worlds --- it's not backwards compatible, it's therefore
unsafe, it's slow, *and* it'll be #ifdef hell to read.

On a platform that has pthread_sigmask, ISTM we can use that
unconditionally and it'll work whether the calling app is threaded or
not. We only fall back to the pqsignal method if we aren't supporting
threads. There's no need for a runtime test nor for an API change.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2004-12-02 16:08:20 Re: libpq and psql not on same page about SIGPIPE
Previous Message Bruce Momjian 2004-12-02 15:50:04 Re: [BUGS] pg_autovacuum in 8beta-dev3 small bug

Browse pgsql-patches by date

  From Date Subject
Next Message Bruce Momjian 2004-12-02 16:08:20 Re: libpq and psql not on same page about SIGPIPE
Previous Message Bruce Momjian 2004-12-02 15:50:04 Re: [BUGS] pg_autovacuum in 8beta-dev3 small bug