Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc6f0559

Browse files
committed
Check and set thread-safe functions separately, rather than as a single
variable.Remove thread locking for non-thread-safe functions, instead throw acompile error.Platforms will have to re-run tools/thread to record their threadsafety.
1 parent15b330b commitc6f0559

File tree

12 files changed

+135
-242
lines changed

12 files changed

+135
-242
lines changed

‎configure

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13198,8 +13198,8 @@ fi
1319813198
if test $ac_cv_header_pthread_h = yes; then
1319913199
:
1320013200
else
13201-
{ { echo "$as_me:$LINENO: error: pthread.h not found, required for --enable-thread-safetys" >&5
13202-
echo "$as_me: error: pthread.h not found, required for --enable-thread-safetys" >&2;}
13201+
{ { echo "$as_me:$LINENO: error: pthread.h not found, required for --enable-thread-safety" >&5
13202+
echo "$as_me: error: pthread.h not found, required for --enable-thread-safety" >&2;}
1320313203
{ (exit 1); exit 1; }; }
1320413204
fi
1320513205

@@ -13222,32 +13222,40 @@ See the comment at the top of src/port/thread.c for more information.
1322213222
" >&2;}
1322313223
{ (exit 1); exit 1; }; }
1322413224
fi
13225-
else
13226-
# do not use values from template file
13227-
THREAD_CPPFLAGS=
13228-
THREAD_LIBS=
13229-
fi
13230-
13231-
13232-
13233-
1323413225

1323513226
#
1323613227
# Check for re-entrant versions of certain functions
1323713228
#
1323813229
# Include special flags if threads are enabled _and_ if required for
1323913230
# threading on this platform. Some platforms have *_r functions but
13240-
# their natively named funcs arethreadsafe, and should be used instead.
13231+
# their natively named funcs arethread-safe too.
1324113232
#
13242-
# One trick here is that if we don't call AC_CHECK_FUNCS, the
13233+
# One trick here is that if we don't call AC_CHECK_FUNCS; the
1324313234
# functions are marked "not found", which is perfect.
1324413235
#
13245-
if test "$enable_thread_safety" = yes -a "$NEED_REENTRANT_FUNCS" = yes ; then
13236+
if test "$enable_thread_safety" = yes -a "$STRERROR_THREADSAFE" = yes ; then
13237+
13238+
cat >>confdefs.h <<\_ACEOF
13239+
#define STRERROR_THREADSAFE 1
13240+
_ACEOF
13241+
13242+
fi
13243+
if test "$enable_thread_safety" = yes -a "$GETPWUID_THREADSAFE" = yes ; then
13244+
13245+
cat >>confdefs.h <<\_ACEOF
13246+
#define GETPWUID_THREADSAFE 1
13247+
_ACEOF
13248+
13249+
fi
13250+
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
1324613251

1324713252
cat >>confdefs.h <<\_ACEOF
13248-
#defineNEED_REENTRANT_FUNCS 1
13253+
#defineGETHOSTBYNAME_THREADSAFE 1
1324913254
_ACEOF
1325013255

13256+
fi
13257+
13258+
# Check for *_r functions
1325113259
_CFLAGS="$CFLAGS"
1325213260
_LIBS="$LIBS"
1325313261
CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
@@ -13332,9 +13340,18 @@ done
1333213340

1333313341
CFLAGS="$_CFLAGS"
1333413342
LIBS="$_LIBS"
13343+
13344+
else
13345+
# do not use values from template file
13346+
THREAD_CPPFLAGS=
13347+
THREAD_LIBS=
1333513348
fi
1333613349

1333713350

13351+
13352+
13353+
13354+
1333813355
# This test makes sure that run tests work at all. Sometimes a shared
1333913356
# library is found by the linker, but the runtime linker can't find it.
1334013357
# This check should come after all modifications of compiler or linker

‎configure.in

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.315 2004/02/1117:29:01 momjian Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.316 2004/02/1121:44:04 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -971,7 +971,7 @@ AC_FUNC_FSEEKO
971971
# See the comment at the top of src/port/thread.c for more information.
972972
#
973973
if test "$enable_thread_safety" = yes; then
974-
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safetys])])
974+
AC_CHECK_HEADER(pthread.h, [], [AC_MSG_ERROR([pthread.h not found, required for --enable-thread-safety])])
975975

976976
if test "$THREAD_SUPPORT" != yes; then
977977
AC_MSG_ERROR([
@@ -982,37 +982,46 @@ functions, or libraries required for threading support.
982982
See the comment at the top of src/port/thread.c for more information.
983983
])
984984
fi
985-
else
986-
# do not use values from template file
987-
THREAD_CPPFLAGS=
988-
THREAD_LIBS=
989-
fi
990-
AC_SUBST(THREAD_SUPPORT)
991-
AC_SUBST(THREAD_CPPFLAGS)
992-
AC_SUBST(THREAD_LIBS)
993-
994985

995986
#
996987
# Check for re-entrant versions of certain functions
997988
#
998989
# Include special flags if threads are enabled _and_ if required for
999990
# threading on this platform. Some platforms have *_r functions but
1000-
# their natively named funcs arethreadsafe, and should be used instead.
991+
# their natively named funcs arethread-safe too.
1001992
#
1002-
# One trick here is that if we don't call AC_CHECK_FUNCS, the
993+
# One trick here is that if we don't call AC_CHECK_FUNCS; the
1003994
# functions are marked "not found", which is perfect.
1004995
#
1005-
if test "$enable_thread_safety" = yes -a "$NEED_REENTRANT_FUNCS" = yes ; then
1006-
AC_DEFINE(NEED_REENTRANT_FUNCS, 1, [Define if non *_r libc functions are not thread safe])
996+
if test "$enable_thread_safety" = yes -a "$STRERROR_THREADSAFE" = yes ; then
997+
AC_DEFINE(STRERROR_THREADSAFE, 1, [Define if strerror is not thread safe])
998+
fi
999+
if test "$enable_thread_safety" = yes -a "$GETPWUID_THREADSAFE" = yes ; then
1000+
AC_DEFINE(GETPWUID_THREADSAFE, 1, [Define if getpwuid is not thread safe])
1001+
fi
1002+
if test "$enable_thread_safety" = yes -a "$GETHOSTBYNAME_THREADSAFE" = yes ; then
1003+
AC_DEFINE(GETHOSTBYNAME_THREADSAFE, 1, [Define if gethostbyname is not thread safe])
1004+
fi
1005+
1006+
# Check for *_r functions
10071007
_CFLAGS="$CFLAGS"
10081008
_LIBS="$LIBS"
10091009
CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
10101010
LIBS="$LIBS $THREAD_LIBS"
10111011
AC_CHECK_FUNCS([strerror_r getpwuid_r gethostbyname_r])
10121012
CFLAGS="$_CFLAGS"
10131013
LIBS="$_LIBS"
1014+
1015+
else
1016+
# do not use values from template file
1017+
THREAD_CPPFLAGS=
1018+
THREAD_LIBS=
10141019
fi
10151020

1021+
AC_SUBST(THREAD_SUPPORT)
1022+
AC_SUBST(THREAD_CPPFLAGS)
1023+
AC_SUBST(THREAD_LIBS)
1024+
10161025

10171026
# This test makes sure that run tests work at all. Sometimes a shared
10181027
# library is found by the linker, but the runtime linker can't find it.

‎src/include/pg_config.h.in

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,12 @@
4343
(--enable-thread-safety) */
4444
#undef ENABLE_THREAD_SAFETY
4545

46+
/* Define if gethostbyname is not thread safe */
47+
#undef GETHOSTBYNAME_THREADSAFE
48+
49+
/* Define if getpwuid is not thread safe */
50+
#undef GETPWUID_THREADSAFE
51+
4652
/* Define to 1 if gettimeofday() takes only 1 argument. */
4753
#undef GETTIMEOFDAY_1ARG
4854

@@ -554,9 +560,6 @@
554560
/* Define as the maximum alignment requirement of any C data type. */
555561
#undef MAXIMUM_ALIGNOF
556562

557-
/* Define if non *_r libc functions are not thread safe */
558-
#undef NEED_REENTRANT_FUNCS
559-
560563
/* Define to the address where bug reports for this package should be sent. */
561564
#undef PACKAGE_BUGREPORT
562565

@@ -588,6 +591,9 @@
588591
/* Define to 1 if you have the ANSI C header files. */
589592
#undef STDC_HEADERS
590593

594+
/* Define if strerror is not thread safe */
595+
#undef STRERROR_THREADSAFE
596+
591597
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
592598
#undef TM_IN_SYS_TIME
593599

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp