1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-30 11:03:19 +03:00

Rework libpq threaded SIGPIPE handling to avoid interference with

calling applications.  This is done by blocking sigpipe in the libpq
thread and using sigpending/sigwait to possibily discard any sigpipe we
generated.
This commit is contained in:
Bruce Momjian
2004-12-02 15:32:54 +00:00
parent e02ef267fc
commit 8408f65252
9 changed files with 113 additions and 105 deletions

View File

@ -1,5 +1,5 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.169 2004/11/27 21:56:04 petere Exp $
$PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.170 2004/12/02 15:32:52 momjian Exp $
-->
<chapter id="libpq">
@ -3954,24 +3954,6 @@ safety</></> It is better to use the <literal>md5</literal> method,
which is thread-safe on all platforms.
</para>
<para>
<application>libpq</application> must ignore <literal>SIGPIPE</> signals
generated internally by <function>send()</> calls to backend processes.
When <productname>PostgreSQL</> is configured without
<literal>--enable-thread-safety</>, <application>libpq</> sets
<literal>SIGPIPE</> to <literal>SIG_IGN</> before each
<function>send()</> call and restores the original signal handler after
completion. When <literal>--enable-thread-safety</> is used,
<application>libpq</> installs its own <literal>SIGPIPE</> handler
before the first database connection. This handler uses thread-local
storage to determine if a <literal>SIGPIPE</> signal has been generated
by a libpq <function>send()</>. If an application wants to install
its own <literal>SIGPIPE</> signal handler, it should call
<function>PQinSend()</> to determine if it should ignore the
<literal>SIGPIPE</> signal. This function is available in both
thread-safe and non-thread-safe versions of <application>libpq</>.
</para>
<para>
If you experience problems with threaded applications, run
the program in <filename>src/tools/thread</> to see if your

View File

@ -1,8 +1,9 @@
<!--
$PostgreSQL: pgsql/doc/src/sgml/ref/copy.sgml,v 1.60 2004/11/27 21:56:05 petere Exp $
$PostgreSQL: pgsql/doc/src/sgml/ref/copy.sgml,v 1.61 2004/12/02 15:32:53 momjian Exp $
PostgreSQL documentation
-->
<refentry id="SQL-COPY">
<refmeta>
<refentrytitle id="sql-copy-title">COPY</refentrytitle>