Re: [PATCH v4] [libpq] Try to avoid manually masking SIGPIPEs on every send()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeremy Kerr <jk(at)ozlabs(dot)org>
Cc: pgsql-hackers(at)postgresql(dot)org, Robert Haas <robertmhaas(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: [PATCH v4] [libpq] Try to avoid manually masking SIGPIPEs on every send()
Date: 2009-07-24 17:59:45
Message-ID: 1514.1248458385@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Jeremy Kerr <jk(at)ozlabs(dot)org> writes:
> Currently, libpq will wrap each send() call on the connection with
> two system calls to mask SIGPIPEs. This results in 3 syscalls instead
> of one, and (on Linux) can lead to high contention on the signal
> mask locks in threaded apps.

> We have a couple of other methods to avoid SIGPIPEs:
> sockopt(SO_NOSIGPIPE) and the MSG_NOSIGNAL flag to send().

> This change attempts to use these if they're available at compile-
> and run-time. If not, we drop back to manipulating the signal mask as
> before.

Applied with revisions --- those macro definitions were still a mess
:-(. In particular, ({...}) is a gcc-ism.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-07-24 18:05:55 Re: When is a record NULL?
Previous Message Merlin Moncure 2009-07-24 17:44:37 Re: When is a record NULL?