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