Re: [PATCH v4] [libpq] Try to avoid manually masking SIGPIPEs on every send() - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH v4] [libpq] Try to avoid manually masking SIGPIPEs on every send()
Date
Msg-id 1514.1248458385@sss.pgh.pa.us
Whole thread Raw
In response to [PATCH v4] [libpq] Try to avoid manually masking SIGPIPEs on every send()  (Jeremy Kerr <jk@ozlabs.org>)
List pgsql-hackers
Jeremy Kerr <jk@ozlabs.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


pgsql-hackers by date:

Previous
From: Merlin Moncure
Date:
Subject: Re: When is a record NULL?
Next
From: Tom Lane
Date:
Subject: Re: When is a record NULL?