mirror of
https://github.com/postgres/postgres.git
synced 2025-07-28 23:42:10 +03:00
thread-safety
Apply full patch to enable thread-safety by default, e.g. doc changes.
This commit is contained in:
93
configure
vendored
93
configure
vendored
@ -823,7 +823,6 @@ with_CC
|
|||||||
enable_depend
|
enable_depend
|
||||||
enable_cassert
|
enable_cassert
|
||||||
enable_thread_safety
|
enable_thread_safety
|
||||||
enable_thread_safety_force
|
|
||||||
with_tcl
|
with_tcl
|
||||||
with_tclconfig
|
with_tclconfig
|
||||||
with_perl
|
with_perl
|
||||||
@ -1497,9 +1496,7 @@ Optional Features:
|
|||||||
--enable-dtrace build with DTrace support
|
--enable-dtrace build with DTrace support
|
||||||
--enable-depend turn on automatic dependency tracking
|
--enable-depend turn on automatic dependency tracking
|
||||||
--enable-cassert enable assertion checks (for debugging)
|
--enable-cassert enable assertion checks (for debugging)
|
||||||
--disable-thread-safety make client libraries thread-safe
|
--disable-thread-safety disable thread-safety in client libraries
|
||||||
--enable-thread-safety-force
|
|
||||||
force thread-safety despite thread test failure
|
|
||||||
--disable-float4-byval disable float4 passed by value
|
--disable-float4-byval disable float4 passed by value
|
||||||
--disable-float8-byval disable float8 passed by value
|
--disable-float8-byval disable float8 passed by value
|
||||||
--disable-largefile omit support for large files
|
--disable-largefile omit support for large files
|
||||||
@ -4884,41 +4881,6 @@ else
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Check whether --enable-thread-safety-force was given.
|
|
||||||
if test "${enable_thread_safety_force+set}" = set; then
|
|
||||||
enableval=$enable_thread_safety_force;
|
|
||||||
case $enableval in
|
|
||||||
yes)
|
|
||||||
:
|
|
||||||
;;
|
|
||||||
no)
|
|
||||||
:
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
{ { $as_echo "$as_me:$LINENO: error: no argument expected for --enable-thread-safety-force option" >&5
|
|
||||||
$as_echo "$as_me: error: no argument expected for --enable-thread-safety-force option" >&2;}
|
|
||||||
{ (exit 1); exit 1; }; }
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
else
|
|
||||||
enable_thread_safety_force=no
|
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if test "$enable_thread_safety" = yes -o \
|
|
||||||
"$enable_thread_safety_force" = yes; then
|
|
||||||
enable_thread_safety="yes" # for 'force'
|
|
||||||
|
|
||||||
cat >>confdefs.h <<\_ACEOF
|
|
||||||
#define ENABLE_THREAD_SAFETY 1
|
|
||||||
_ACEOF
|
|
||||||
|
|
||||||
fi
|
|
||||||
{ $as_echo "$as_me:$LINENO: result: $enable_thread_safety" >&5
|
{ $as_echo "$as_me:$LINENO: result: $enable_thread_safety" >&5
|
||||||
$as_echo "$enable_thread_safety" >&6; }
|
$as_echo "$enable_thread_safety" >&6; }
|
||||||
|
|
||||||
@ -21287,10 +21249,10 @@ PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEM
|
|||||||
if test "$PTHREAD_CC" != "$CC"; then
|
if test "$PTHREAD_CC" != "$CC"; then
|
||||||
{ { $as_echo "$as_me:$LINENO: error:
|
{ { $as_echo "$as_me:$LINENO: error:
|
||||||
PostgreSQL does not support platforms that require a special compiler
|
PostgreSQL does not support platforms that require a special compiler
|
||||||
for thread safety." >&5
|
for thread safety; use --disable-thread-safety to disable thread safety." >&5
|
||||||
$as_echo "$as_me: error:
|
$as_echo "$as_me: error:
|
||||||
PostgreSQL does not support platforms that require a special compiler
|
PostgreSQL does not support platforms that require a special compiler
|
||||||
for thread safety." >&2;}
|
for thread safety; use --disable-thread-safety to disable thread safety." >&2;}
|
||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -21436,8 +21398,10 @@ fi
|
|||||||
if test "x$ac_cv_header_pthread_h" = x""yes; then
|
if test "x$ac_cv_header_pthread_h" = x""yes; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
{ { $as_echo "$as_me:$LINENO: error: pthread.h not found, required for --enable-thread-safety" >&5
|
{ { $as_echo "$as_me:$LINENO: error:
|
||||||
$as_echo "$as_me: error: pthread.h not found, required for --enable-thread-safety" >&2;}
|
pthread.h not found; use --disable-thread-safety to disable thread safety" >&5
|
||||||
|
$as_echo "$as_me: error:
|
||||||
|
pthread.h not found; use --disable-thread-safety to disable thread safety" >&2;}
|
||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -26349,10 +26313,10 @@ HAVE_POSIX_SIGNALS=$pgac_cv_func_posix_signals
|
|||||||
if test "$pgac_cv_func_posix_signals" != yes -a "$enable_thread_safety" = yes; then
|
if test "$pgac_cv_func_posix_signals" != yes -a "$enable_thread_safety" = yes; then
|
||||||
{ { $as_echo "$as_me:$LINENO: error:
|
{ { $as_echo "$as_me:$LINENO: error:
|
||||||
Thread-safety requires POSIX signals, which are not supported by this
|
Thread-safety requires POSIX signals, which are not supported by this
|
||||||
operating system." >&5
|
operating system; use --disable-thread-safety to disable thread safety." >&5
|
||||||
$as_echo "$as_me: error:
|
$as_echo "$as_me: error:
|
||||||
Thread-safety requires POSIX signals, which are not supported by this
|
Thread-safety requires POSIX signals, which are not supported by this
|
||||||
operating system." >&2;}
|
operating system; use --disable-thread-safety to disable thread safety." >&2;}
|
||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -28202,24 +28166,7 @@ done
|
|||||||
# We have to run the thread test near the end so we have all our symbols
|
# We have to run the thread test near the end so we have all our symbols
|
||||||
# defined. Cross compiling throws a warning.
|
# defined. Cross compiling throws a warning.
|
||||||
#
|
#
|
||||||
if test "$enable_thread_safety_force" = yes; then
|
if test "$enable_thread_safety" = yes; then
|
||||||
if test "$PORTNAME" != "win32"
|
|
||||||
then
|
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING:
|
|
||||||
*** Skipping thread test program. --enable-thread-safety-force was used.
|
|
||||||
*** Run the program in src/test/thread on the your machine and add proper
|
|
||||||
*** locking function calls to your applications to guarantee thread safety.
|
|
||||||
" >&5
|
|
||||||
$as_echo "$as_me: WARNING:
|
|
||||||
*** Skipping thread test program. --enable-thread-safety-force was used.
|
|
||||||
*** Run the program in src/test/thread on the your machine and add proper
|
|
||||||
*** locking function calls to your applications to guarantee thread safety.
|
|
||||||
" >&2;}
|
|
||||||
else
|
|
||||||
{ $as_echo "$as_me:$LINENO: WARNING: *** skipping thread test on Win32" >&5
|
|
||||||
$as_echo "$as_me: WARNING: *** skipping thread test on Win32" >&2;}
|
|
||||||
fi
|
|
||||||
elif test "$enable_thread_safety" = yes; then
|
|
||||||
if test "$PORTNAME" != "win32"
|
if test "$PORTNAME" != "win32"
|
||||||
then
|
then
|
||||||
{ $as_echo "$as_me:$LINENO: checking thread safety of required library functions" >&5
|
{ $as_echo "$as_me:$LINENO: checking thread safety of required library functions" >&5
|
||||||
@ -28282,21 +28229,13 @@ sed 's/^/| /' conftest.$ac_ext >&5
|
|||||||
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
{ $as_echo "$as_me:$LINENO: result: no" >&5
|
||||||
$as_echo "no" >&6; }
|
$as_echo "no" >&6; }
|
||||||
{ { $as_echo "$as_me:$LINENO: error: thread test program failed
|
{ { $as_echo "$as_me:$LINENO: error: thread test program failed
|
||||||
This platform is not thread-safe. Check the file 'config.log' for the
|
This platform is not thread-safe. Check the file 'config.log' or compile
|
||||||
exact reason.
|
and run src/test/thread/thread_test for the exact reason.
|
||||||
|
Use --disable-thread-safety to disable thread safety." >&5
|
||||||
You can use the configure option --enable-thread-safety-force to force
|
|
||||||
threads to be enabled. But you must then run the program in
|
|
||||||
src/test/thread and add locking function calls to your applications to
|
|
||||||
guarantee thread safety." >&5
|
|
||||||
$as_echo "$as_me: error: thread test program failed
|
$as_echo "$as_me: error: thread test program failed
|
||||||
This platform is not thread-safe. Check the file 'config.log' for the
|
This platform is not thread-safe. Check the file 'config.log' or compile
|
||||||
exact reason.
|
and run src/test/thread/thread_test for the exact reason.
|
||||||
|
Use --disable-thread-safety to disable thread safety." >&2;}
|
||||||
You can use the configure option --enable-thread-safety-force to force
|
|
||||||
threads to be enabled. But you must then run the program in
|
|
||||||
src/test/thread and add locking function calls to your applications to
|
|
||||||
guarantee thread safety." >&2;}
|
|
||||||
{ (exit 1); exit 1; }; }
|
{ (exit 1); exit 1; }; }
|
||||||
fi
|
fi
|
||||||
rm -rf conftest.dSYM
|
rm -rf conftest.dSYM
|
||||||
|
42
configure.in
42
configure.in
@ -1,5 +1,5 @@
|
|||||||
dnl Process this file with autoconf to produce a configure script.
|
dnl Process this file with autoconf to produce a configure script.
|
||||||
dnl $PostgreSQL: pgsql/configure.in,v 1.614 2009/12/01 23:02:44 momjian Exp $
|
dnl $PostgreSQL: pgsql/configure.in,v 1.615 2009/12/02 14:07:25 momjian Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -558,15 +558,7 @@ IFS=$ac_save_IFS
|
|||||||
# Enable thread-safe client libraries
|
# Enable thread-safe client libraries
|
||||||
#
|
#
|
||||||
AC_MSG_CHECKING([allow thread-safe client libraries])
|
AC_MSG_CHECKING([allow thread-safe client libraries])
|
||||||
PGAC_ARG_BOOL(enable, thread-safety, yes, [make client libraries thread-safe])
|
PGAC_ARG_BOOL(enable, thread-safety, yes, [disable thread-safety in client libraries])
|
||||||
|
|
||||||
PGAC_ARG_BOOL(enable, thread-safety-force, no, [force thread-safety despite thread test failure])
|
|
||||||
if test "$enable_thread_safety" = yes -o \
|
|
||||||
"$enable_thread_safety_force" = yes; then
|
|
||||||
enable_thread_safety="yes" # for 'force'
|
|
||||||
AC_DEFINE([ENABLE_THREAD_SAFETY], 1,
|
|
||||||
[Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])
|
|
||||||
fi
|
|
||||||
AC_MSG_RESULT([$enable_thread_safety])
|
AC_MSG_RESULT([$enable_thread_safety])
|
||||||
AC_SUBST(enable_thread_safety)
|
AC_SUBST(enable_thread_safety)
|
||||||
|
|
||||||
@ -1399,7 +1391,7 @@ PTHREAD_CFLAGS="$PTHREAD_CFLAGS -D_REENTRANT -D_THREAD_SAFE -D_POSIX_PTHREAD_SEM
|
|||||||
if test "$PTHREAD_CC" != "$CC"; then
|
if test "$PTHREAD_CC" != "$CC"; then
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
PostgreSQL does not support platforms that require a special compiler
|
PostgreSQL does not support platforms that require a special compiler
|
||||||
for thread safety.])
|
for thread safety; use --disable-thread-safety to disable thread safety.])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for *_r functions
|
# Check for *_r functions
|
||||||
@ -1409,7 +1401,8 @@ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
|
|||||||
LIBS="$LIBS $PTHREAD_LIBS"
|
LIBS="$LIBS $PTHREAD_LIBS"
|
||||||
|
|
||||||
if test "$PORTNAME" != "win32"; then
|
if test "$PORTNAME" != "win32"; then
|
||||||
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safety])])
|
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([
|
||||||
|
pthread.h not found; use --disable-thread-safety to disable thread safety])])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
|
AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
|
||||||
@ -1655,7 +1648,7 @@ PGAC_FUNC_POSIX_SIGNALS
|
|||||||
if test "$pgac_cv_func_posix_signals" != yes -a "$enable_thread_safety" = yes; then
|
if test "$pgac_cv_func_posix_signals" != yes -a "$enable_thread_safety" = yes; then
|
||||||
AC_MSG_ERROR([
|
AC_MSG_ERROR([
|
||||||
Thread-safety requires POSIX signals, which are not supported by this
|
Thread-safety requires POSIX signals, which are not supported by this
|
||||||
operating system.])
|
operating system; use --disable-thread-safety to disable thread safety.])
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1744,18 +1737,7 @@ AC_CHECK_PROGS(OSX, [osx sgml2xml sx])
|
|||||||
# We have to run the thread test near the end so we have all our symbols
|
# We have to run the thread test near the end so we have all our symbols
|
||||||
# defined. Cross compiling throws a warning.
|
# defined. Cross compiling throws a warning.
|
||||||
#
|
#
|
||||||
if test "$enable_thread_safety_force" = yes; then
|
if test "$enable_thread_safety" = yes; then
|
||||||
if test "$PORTNAME" != "win32"
|
|
||||||
then
|
|
||||||
AC_MSG_WARN([
|
|
||||||
*** Skipping thread test program. --enable-thread-safety-force was used.
|
|
||||||
*** Run the program in src/test/thread on the your machine and add proper
|
|
||||||
*** locking function calls to your applications to guarantee thread safety.
|
|
||||||
])
|
|
||||||
else
|
|
||||||
AC_MSG_WARN([*** skipping thread test on Win32])
|
|
||||||
fi
|
|
||||||
elif test "$enable_thread_safety" = yes; then
|
|
||||||
if test "$PORTNAME" != "win32"
|
if test "$PORTNAME" != "win32"
|
||||||
then
|
then
|
||||||
AC_MSG_CHECKING([thread safety of required library functions])
|
AC_MSG_CHECKING([thread safety of required library functions])
|
||||||
@ -1768,13 +1750,9 @@ AC_TRY_RUN([#include "$srcdir/src/test/thread/thread_test.c"],
|
|||||||
[AC_MSG_RESULT(yes)],
|
[AC_MSG_RESULT(yes)],
|
||||||
[AC_MSG_RESULT(no)
|
[AC_MSG_RESULT(no)
|
||||||
AC_MSG_ERROR([thread test program failed
|
AC_MSG_ERROR([thread test program failed
|
||||||
This platform is not thread-safe. Check the file 'config.log' for the
|
This platform is not thread-safe. Check the file 'config.log' or compile
|
||||||
exact reason.
|
and run src/test/thread/thread_test for the exact reason.
|
||||||
|
Use --disable-thread-safety to disable thread safety.])],
|
||||||
You can use the configure option --enable-thread-safety-force to force
|
|
||||||
threads to be enabled. But you must then run the program in
|
|
||||||
src/test/thread and add locking function calls to your applications to
|
|
||||||
guarantee thread safety.])],
|
|
||||||
[AC_MSG_RESULT(maybe)
|
[AC_MSG_RESULT(maybe)
|
||||||
AC_MSG_WARN([
|
AC_MSG_WARN([
|
||||||
*** Skipping thread test program because of cross-compile build.
|
*** Skipping thread test program because of cross-compile build.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.92 2009/11/30 14:47:37 momjian Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/ecpg.sgml,v 1.93 2009/12/02 14:07:25 momjian Exp $ -->
|
||||||
|
|
||||||
<chapter id="ecpg">
|
<chapter id="ecpg">
|
||||||
<title><application>ECPG</application> - Embedded <acronym>SQL</acronym> in C</title>
|
<title><application>ECPG</application> - Embedded <acronym>SQL</acronym> in C</title>
|
||||||
@ -4709,10 +4709,9 @@ ECPG = ecpg
|
|||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The <application>ecpg</application> library is thread-safe if it is built
|
The <application>ecpg</application> library is thread-safe by
|
||||||
using the <option>--enable-thread-safety</> command-line option to
|
default. However, you might need to use some threading
|
||||||
<filename>configure</filename>. (You might need to use other threading
|
command-line options to compile your client code.
|
||||||
command-line options to compile your client code.)
|
|
||||||
</para>
|
</para>
|
||||||
</sect1>
|
</sect1>
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.327 2009/08/12 16:32:35 petere Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/installation.sgml,v 1.328 2009/12/02 14:07:25 momjian Exp $ -->
|
||||||
|
|
||||||
<chapter id="installation">
|
<chapter id="installation">
|
||||||
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
<title><![%standalone-include[<productname>PostgreSQL</>]]>
|
||||||
@ -1164,14 +1164,13 @@ su - postgres
|
|||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term><option>--enable-thread-safety</option></term>
|
<term><option>--disable-thread-safety</option></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
<para>
|
<para>
|
||||||
Make the client libraries thread-safe. This allows
|
Disable the thread-safety of client libraries. This prevents
|
||||||
concurrent threads in <application>libpq</application> and
|
concurrent threads in <application>libpq</application> and
|
||||||
<application>ECPG</application> programs to safely control
|
<application>ECPG</application> programs from safely controlling
|
||||||
their private connection handles. This option requires adequate
|
their private connection handles.
|
||||||
threading support in your operating system.
|
|
||||||
</para>
|
</para>
|
||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
@ -2835,12 +2834,10 @@ MANPATH=/usr/lib/scohelp/%L/man:/usr/dt/man:/usr/man:/usr/share/man:scohelp:/usr
|
|||||||
</sect3>
|
</sect3>
|
||||||
|
|
||||||
<sect3>
|
<sect3>
|
||||||
<title><option>--enable-thread-safety</option> and UnixWare</title>
|
<title>Threading on UnixWare</title>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
If you use the <command>configure</command>
|
For threading, you<emphasis>must</emphasis> use <option>-Kpthread</option>
|
||||||
option <option>--enable-thread-safety</option>,
|
|
||||||
you <emphasis>must</emphasis> use <option>-Kpthread</option>
|
|
||||||
on <emphasis>all</emphasis> libpq-using programs. libpq
|
on <emphasis>all</emphasis> libpq-using programs. libpq
|
||||||
uses <function>pthread_*</function> calls, which are only
|
uses <function>pthread_*</function> calls, which are only
|
||||||
available with the
|
available with the
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.291 2009/12/02 04:54:10 tgl Exp $ -->
|
<!-- $PostgreSQL: pgsql/doc/src/sgml/libpq.sgml,v 1.292 2009/12/02 14:07:25 momjian Exp $ -->
|
||||||
|
|
||||||
<chapter id="libpq">
|
<chapter id="libpq">
|
||||||
<title><application>libpq</application> - C Library</title>
|
<title><application>libpq</application> - C Library</title>
|
||||||
@ -6579,11 +6579,8 @@ myEventProc(PGEventId evtId, void *evtInfo, void *passThrough)
|
|||||||
</indexterm>
|
</indexterm>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
<application>libpq</application> is reentrant and thread-safe if the
|
<application>libpq</application> is reentrant and thread-safe by default.
|
||||||
<filename>configure</filename> command-line option
|
You might need to use special compiler command-line
|
||||||
<literal>--enable-thread-safety</> was used when the
|
|
||||||
<productname>PostgreSQL</productname> distribution was built. In
|
|
||||||
addition, you might need to use additional compiler command-line
|
|
||||||
options when you compile your application code. Refer to your
|
options when you compile your application code. Refer to your
|
||||||
system's documentation for information about how to build
|
system's documentation for information about how to build
|
||||||
thread-enabled applications, or look in
|
thread-enabled applications, or look in
|
||||||
|
@ -1,17 +1,18 @@
|
|||||||
$PostgreSQL: pgsql/src/test/thread/README,v 1.2 2008/03/21 13:23:29 momjian Exp $
|
$PostgreSQL: pgsql/src/test/thread/README,v 1.3 2009/12/02 14:07:26 momjian Exp $
|
||||||
|
|
||||||
Threading
|
Threading
|
||||||
=========
|
=========
|
||||||
|
|
||||||
This program should be run by developers wishing to enable threading on
|
This program is run by configure to determine if threading is
|
||||||
new platforms.
|
properly supported on the platform.
|
||||||
|
|
||||||
Run thread_test program to determine if your native libc functions are
|
You can run the program manually to see details, which shows if your
|
||||||
thread-safe, or if we should use *_r functions or thread locking.
|
native libc functions are thread-safe, or if we use *_r functions or
|
||||||
|
thread locking.
|
||||||
|
|
||||||
To use this program, you must:
|
To use this program manually, you must:
|
||||||
|
|
||||||
o run "configure --enable-thread-safety"
|
o run "configure"
|
||||||
o compile the main source tree
|
o compile the main source tree
|
||||||
o compile and run this program
|
o compile and run this program
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user