Thread: Threading bug

Threading bug

From
Bruce Momjian
Date:
I found a bug in my coding of the thread-detection logic.  I was not
setting NEED_REENTRANT_FUNCS properly, so locking and *_r functions
where not being used.

The has been backpatched to 7.4.X.

--
  Bruce Momjian                        |  http://candle.pha.pa.us
  pgman@candle.pha.pa.us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073
Index: configure
===================================================================
RCS file: /cvsroot/pgsql-server/configure,v
retrieving revision 1.326
diff -c -c -r1.326 configure
*** configure    10 Feb 2004 19:55:45 -0000    1.326
--- configure    11 Feb 2004 17:18:23 -0000
***************
*** 13243,13248 ****
--- 13243,13253 ----
  # functions are marked "not found", which is perfect.
  #
  if test "$enable_thread_safety" = yes -a "$NEED_REENTRANT_FUNCS" = yes ; then
+
+ cat >>confdefs.h <<\_ACEOF
+ #define NEED_REENTRANT_FUNCS 1
+ _ACEOF
+
  _CFLAGS="$CFLAGS"
  _LIBS="$LIBS"
  CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
Index: configure.in
===================================================================
RCS file: /cvsroot/pgsql-server/configure.in,v
retrieving revision 1.314
diff -c -c -r1.314 configure.in
*** configure.in    10 Feb 2004 19:55:45 -0000    1.314
--- configure.in    11 Feb 2004 17:18:25 -0000
***************
*** 1003,1008 ****
--- 1003,1009 ----
  # functions are marked "not found", which is perfect.
  #
  if test "$enable_thread_safety" = yes -a "$NEED_REENTRANT_FUNCS" = yes ; then
+ AC_DEFINE(NEED_REENTRANT_FUNCS, 1, [Define if non *_r libc functions are not thread safe])
  _CFLAGS="$CFLAGS"
  _LIBS="$LIBS"
  CFLAGS="$CFLAGS $THREAD_CPPFLAGS"
Index: src/include/pg_config.h.in
===================================================================
RCS file: /cvsroot/pgsql-server/src/include/pg_config.h.in,v
retrieving revision 1.66
diff -c -c -r1.66 pg_config.h.in
*** src/include/pg_config.h.in    10 Feb 2004 19:55:45 -0000    1.66
--- src/include/pg_config.h.in    11 Feb 2004 17:18:31 -0000
***************
*** 554,559 ****
--- 554,562 ----
  /* Define as the maximum alignment requirement of any C data type. */
  #undef MAXIMUM_ALIGNOF

+ /* Define if non *_r libc functions are not thread safe */
+ #undef NEED_REENTRANT_FUNCS
+
  /* Define to the address where bug reports for this package should be sent. */
  #undef PACKAGE_BUGREPORT