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

thread-safety

Apply full patch to enable thread-safety by default, e.g. doc changes.
This commit is contained in:
Bruce Momjian
2009-12-02 14:07:26 +00:00
parent aebc4e67ff
commit 8c1c2e38f6
6 changed files with 48 additions and 137 deletions

View File

@ -1,5 +1,5 @@
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 Developers, please strive to achieve this order:
dnl
@ -558,15 +558,7 @@ IFS=$ac_save_IFS
# Enable 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-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
PGAC_ARG_BOOL(enable, thread-safety, yes, [disable thread-safety in client libraries])
AC_MSG_RESULT([$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
AC_MSG_ERROR([
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
# Check for *_r functions
@ -1409,7 +1401,8 @@ CFLAGS="$CFLAGS $PTHREAD_CFLAGS"
LIBS="$LIBS $PTHREAD_LIBS"
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
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
AC_MSG_ERROR([
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
@ -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
# defined. Cross compiling throws a warning.
#
if test "$enable_thread_safety_force" = 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 "$enable_thread_safety" = yes; then
if test "$PORTNAME" != "win32"
then
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(no)
AC_MSG_ERROR([thread test program failed
This platform is not thread-safe. Check the file 'config.log' for the
exact reason.
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.])],
This platform is not thread-safe. Check the file 'config.log' or compile
and run src/test/thread/thread_test for the exact reason.
Use --disable-thread-safety to disable thread safety.])],
[AC_MSG_RESULT(maybe)
AC_MSG_WARN([
*** Skipping thread test program because of cross-compile build.