1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +03:00

Check and set thread-safe functions separately, rather than as a single

variable.

Remove thread locking for non-thread-safe functions, instead throw a
compile error.

Platforms will have to re-run tools/thread to record their thread
safety.
This commit is contained in:
Bruce Momjian
2004-02-11 21:44:06 +00:00
parent 15b330b648
commit c6f0559371
12 changed files with 134 additions and 241 deletions

47
configure vendored
View File

@ -13198,8 +13198,8 @@ fi
if test $ac_cv_header_pthread_h = yes; then
:
else
{ { echo "$as_me:$LINENO: error: pthread.h not found, required for --enable-thread-safetys" >&5
echo "$as_me: error: pthread.h not found, required for --enable-thread-safetys" >&2;}
{ { echo "$as_me:$LINENO: error: pthread.h not found, required for --enable-thread-safety" >&5
echo "$as_me: error: pthread.h not found, required for --enable-thread-safety" >&2;}
{ (exit 1); exit 1; }; }
fi
@ -13222,32 +13222,40 @@ See the comment at the top of src/port/thread.c for more information.
" >&2;}
{ (exit 1); exit 1; }; }
fi
else
# do not use values from template file
THREAD_CPPFLAGS=
THREAD_LIBS=
fi
#
# Check for re-entrant versions of certain functions
#
# Include special flags if threads are enabled _and_ if required for
# threading on this platform. Some platforms have *_r functions but
# their natively named funcs are threadsafe, and should be used instead.
# their natively named funcs are thread-safe too.
#
# One trick here is that if we don't call AC_CHECK_FUNCS, the
# One trick here is that if we don't call AC_CHECK_FUNCS; the
# functions are marked "not found", which is perfect.
#
if test "$enable_thread_safety" = yes -a "$NEED_REENTRANT_FUNCS" = yes ; then
if test "$enable_thread_safety" = yes -a "$STRERROR_THREADSAFE" = yes ; then
cat >>confdefs.h <<\_ACEOF
#define NEED_REENTRANT_FUNCS 1
#define STRERROR_THREADSAFE 1
_ACEOF
fi
if test "$enable_thread_safety" = yes -a "$GETPWUID_THREADSAFE" = yes ; then
cat >>confdefs.h <<\_ACEOF
#define GETPWUID_THREADSAFE 1
_ACEOF
fi
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
cat >>confdefs.h <<\_ACEOF
#define GETHOSTBYNAME_THREADSAFE 1
_ACEOF
fi
# Check for *_r functions
_CFLAGS="$CFLAGS"
_LIBS="$LIBS"
CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
@ -13332,9 +13340,18 @@ done
CFLAGS="$_CFLAGS"
LIBS="$_LIBS"
else
# do not use values from template file
THREAD_CPPFLAGS=
THREAD_LIBS=
fi
# This test makes sure that run tests work at all. Sometimes a shared
# library is found by the linker, but the runtime linker can't find it.
# This check should come after all modifications of compiler or linker