Rename USE_THREADS to ENABLE_THREAD_SAFETY to avoid name clash with Perl.
Fixes compilation failure with --enable-thread-safety --with-perl and Perl 5.6.1.
This commit is contained in:
parent
040e1cef91
commit
8878cc4cd7
2
configure
vendored
2
configure
vendored
@ -2909,7 +2909,7 @@ if test "${enable_thread_safety+set}" = set; then
|
|||||||
yes)
|
yes)
|
||||||
|
|
||||||
cat >>confdefs.h <<\_ACEOF
|
cat >>confdefs.h <<\_ACEOF
|
||||||
#define USE_THREADS 1
|
#define ENABLE_THREAD_SAFETY 1
|
||||||
_ACEOF
|
_ACEOF
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
@ -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 $Header: /cvsroot/pgsql/configure.in,v 1.302 2003/11/03 14:42:08 tgl Exp $
|
dnl $Header: /cvsroot/pgsql/configure.in,v 1.303 2003/11/24 13:16:22 petere Exp $
|
||||||
dnl
|
dnl
|
||||||
dnl Developers, please strive to achieve this order:
|
dnl Developers, please strive to achieve this order:
|
||||||
dnl
|
dnl
|
||||||
@ -351,7 +351,7 @@ IFS=$ac_save_IFS
|
|||||||
#
|
#
|
||||||
AC_MSG_CHECKING([allow thread-safe client libraries])
|
AC_MSG_CHECKING([allow thread-safe client libraries])
|
||||||
PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety make client libraries thread-safe],
|
PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety make client libraries thread-safe],
|
||||||
[AC_DEFINE([USE_THREADS], 1,
|
[AC_DEFINE([ENABLE_THREAD_SAFETY], 1,
|
||||||
[Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])])
|
[Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])])
|
||||||
AC_MSG_RESULT([$enable_thread_safety])
|
AC_MSG_RESULT([$enable_thread_safety])
|
||||||
AC_SUBST(enable_thread_safety)
|
AC_SUBST(enable_thread_safety)
|
||||||
|
@ -39,6 +39,10 @@
|
|||||||
/* Define to 1 if you want National Language Support. (--enable-nls) */
|
/* Define to 1 if you want National Language Support. (--enable-nls) */
|
||||||
#undef ENABLE_NLS
|
#undef ENABLE_NLS
|
||||||
|
|
||||||
|
/* Define to 1 to build client libraries as thread-safe code.
|
||||||
|
(--enable-thread-safety) */
|
||||||
|
#undef ENABLE_THREAD_SAFETY
|
||||||
|
|
||||||
/* Define to 1 if gettimeofday() takes only 1 argument. */
|
/* Define to 1 if gettimeofday() takes only 1 argument. */
|
||||||
#undef GETTIMEOFDAY_1ARG
|
#undef GETTIMEOFDAY_1ARG
|
||||||
|
|
||||||
@ -609,10 +613,6 @@
|
|||||||
/* Define to select SysV-style shared memory. */
|
/* Define to select SysV-style shared memory. */
|
||||||
#undef USE_SYSV_SHARED_MEMORY
|
#undef USE_SYSV_SHARED_MEMORY
|
||||||
|
|
||||||
/* Define to 1 to build client libraries as thread-safe code.
|
|
||||||
(--enable-thread-safety) */
|
|
||||||
#undef USE_THREADS
|
|
||||||
|
|
||||||
/* Define to select unnamed POSIX semaphores. */
|
/* Define to select unnamed POSIX semaphores. */
|
||||||
#undef USE_UNNAMED_POSIX_SEMAPHORES
|
#undef USE_UNNAMED_POSIX_SEMAPHORES
|
||||||
|
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.17 2003/08/24 18:36:38 petere Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.18 2003/11/24 13:16:22 petere Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
#include "ecpgtype.h"
|
#include "ecpgtype.h"
|
||||||
@ -12,7 +12,7 @@
|
|||||||
#include "extern.h"
|
#include "extern.h"
|
||||||
#include "sqlca.h"
|
#include "sqlca.h"
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
static pthread_mutex_t connections_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t connections_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
#endif
|
#endif
|
||||||
static struct connection *all_connections = NULL;
|
static struct connection *all_connections = NULL;
|
||||||
@ -45,13 +45,13 @@ ECPGget_connection(const char *connection_name)
|
|||||||
{
|
{
|
||||||
struct connection *ret = NULL;
|
struct connection *ret = NULL;
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_lock(&connections_mutex);
|
pthread_mutex_lock(&connections_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ret = ecpg_get_connection_nr(connection_name);
|
ret = ecpg_get_connection_nr(connection_name);
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_unlock(&connections_mutex);
|
pthread_mutex_unlock(&connections_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
realname = strdup(dbname);
|
realname = strdup(dbname);
|
||||||
|
|
||||||
/* add connection to our list */
|
/* add connection to our list */
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_lock(&connections_mutex);
|
pthread_mutex_lock(&connections_mutex);
|
||||||
#endif
|
#endif
|
||||||
if (connection_name != NULL)
|
if (connection_name != NULL)
|
||||||
@ -387,7 +387,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
char *db = realname ? realname : "<DEFAULT>";
|
char *db = realname ? realname : "<DEFAULT>";
|
||||||
|
|
||||||
ecpg_finish(this);
|
ecpg_finish(this);
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_unlock(&connections_mutex);
|
pthread_mutex_unlock(&connections_mutex);
|
||||||
#endif
|
#endif
|
||||||
ECPGlog("connect: could not open database %s on %s port %s %s%s%s%s in line %d\n\t%s\n",
|
ECPGlog("connect: could not open database %s on %s port %s %s%s%s%s in line %d\n\t%s\n",
|
||||||
@ -411,7 +411,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
|
|||||||
ECPGfree(dbname);
|
ECPGfree(dbname);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_unlock(&connections_mutex);
|
pthread_mutex_unlock(&connections_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -440,7 +440,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
|
|||||||
struct sqlca_t *sqlca = ECPGget_sqlca();
|
struct sqlca_t *sqlca = ECPGget_sqlca();
|
||||||
struct connection *con;
|
struct connection *con;
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_lock(&connections_mutex);
|
pthread_mutex_lock(&connections_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -461,7 +461,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
|
|||||||
|
|
||||||
if (!ECPGinit(con, connection_name, lineno))
|
if (!ECPGinit(con, connection_name, lineno))
|
||||||
{
|
{
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_unlock(&connections_mutex);
|
pthread_mutex_unlock(&connections_mutex);
|
||||||
#endif
|
#endif
|
||||||
return (false);
|
return (false);
|
||||||
@ -470,7 +470,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
|
|||||||
ecpg_finish(con);
|
ecpg_finish(con);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_unlock(&connections_mutex);
|
pthread_mutex_unlock(&connections_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.16 2003/10/21 15:34:34 tgl Exp $ */
|
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.17 2003/11/24 13:16:22 petere Exp $ */
|
||||||
|
|
||||||
#define POSTGRES_ECPG_INTERNAL
|
#define POSTGRES_ECPG_INTERNAL
|
||||||
#include "postgres_fe.h"
|
#include "postgres_fe.h"
|
||||||
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
#include "ecpgtype.h"
|
#include "ecpgtype.h"
|
||||||
@ -55,7 +55,7 @@ static struct sqlca_t sqlca_init =
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
static pthread_key_t sqlca_key;
|
static pthread_key_t sqlca_key;
|
||||||
static pthread_once_t sqlca_key_once = PTHREAD_ONCE_INIT;
|
static pthread_once_t sqlca_key_once = PTHREAD_ONCE_INIT;
|
||||||
|
|
||||||
@ -88,7 +88,7 @@ static struct sqlca_t sqlca =
|
|||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static pthread_mutex_t debug_init_mutex = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t debug_init_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
#endif
|
#endif
|
||||||
@ -117,7 +117,7 @@ ECPGinit(const struct connection * con, const char *connection_name, const int l
|
|||||||
return (true);
|
return (true);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
static void
|
static void
|
||||||
ecpg_sqlca_key_init(void)
|
ecpg_sqlca_key_init(void)
|
||||||
{
|
{
|
||||||
@ -128,7 +128,7 @@ ecpg_sqlca_key_init(void)
|
|||||||
struct sqlca_t *
|
struct sqlca_t *
|
||||||
ECPGget_sqlca(void)
|
ECPGget_sqlca(void)
|
||||||
{
|
{
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
struct sqlca_t *sqlca;
|
struct sqlca_t *sqlca;
|
||||||
|
|
||||||
pthread_once(&sqlca_key_once, ecpg_sqlca_key_init);
|
pthread_once(&sqlca_key_once, ecpg_sqlca_key_init);
|
||||||
@ -211,7 +211,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
|
|||||||
void
|
void
|
||||||
ECPGdebug(int n, FILE *dbgs)
|
ECPGdebug(int n, FILE *dbgs)
|
||||||
{
|
{
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_lock(&debug_init_mutex);
|
pthread_mutex_lock(&debug_init_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -219,7 +219,7 @@ ECPGdebug(int n, FILE *dbgs)
|
|||||||
debugstream = dbgs;
|
debugstream = dbgs;
|
||||||
ECPGlog("ECPGdebug: set to %d\n", simple_debug);
|
ECPGlog("ECPGdebug: set to %d\n", simple_debug);
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_unlock(&debug_init_mutex);
|
pthread_mutex_unlock(&debug_init_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@ -229,7 +229,7 @@ ECPGlog(const char *format,...)
|
|||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_lock(&debug_mutex);
|
pthread_mutex_lock(&debug_mutex);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -239,7 +239,7 @@ ECPGlog(const char *format,...)
|
|||||||
|
|
||||||
if (f == NULL)
|
if (f == NULL)
|
||||||
{
|
{
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_unlock(&debug_mutex);
|
pthread_mutex_unlock(&debug_mutex);
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
@ -255,7 +255,7 @@ ECPGlog(const char *format,...)
|
|||||||
ECPGfree(f);
|
ECPGfree(f);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
pthread_mutex_unlock(&debug_mutex);
|
pthread_mutex_unlock(&debug_mutex);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
*
|
*
|
||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
*
|
*
|
||||||
* $Id: thread.c,v 1.12 2003/10/26 04:29:15 momjian Exp $
|
* $Id: thread.c,v 1.13 2003/11/24 13:16:22 petere Exp $
|
||||||
*
|
*
|
||||||
*-------------------------------------------------------------------------
|
*-------------------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@
|
|||||||
#else
|
#else
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
#endif
|
#endif
|
||||||
#if defined(USE_THREADS)
|
#if defined(ENABLE_THREAD_SAFETY)
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -73,7 +73,7 @@
|
|||||||
char *
|
char *
|
||||||
pqStrerror(int errnum, char *strerrbuf, size_t buflen)
|
pqStrerror(int errnum, char *strerrbuf, size_t buflen)
|
||||||
{
|
{
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_STRERROR_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_STRERROR_R)
|
||||||
/* reentrant strerror_r is available */
|
/* reentrant strerror_r is available */
|
||||||
/* some early standards had strerror_r returning char * */
|
/* some early standards had strerror_r returning char * */
|
||||||
strerror_r(errnum, strerrbuf, buflen);
|
strerror_r(errnum, strerrbuf, buflen);
|
||||||
@ -81,7 +81,7 @@ pqStrerror(int errnum, char *strerrbuf, size_t buflen)
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_STRERROR_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_STRERROR_R)
|
||||||
static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
pthread_mutex_lock(&strerror_lock);
|
pthread_mutex_lock(&strerror_lock);
|
||||||
#endif
|
#endif
|
||||||
@ -89,7 +89,7 @@ pqStrerror(int errnum, char *strerrbuf, size_t buflen)
|
|||||||
/* no strerror_r() available, just use strerror */
|
/* no strerror_r() available, just use strerror */
|
||||||
StrNCpy(strerrbuf, strerror(errnum), buflen);
|
StrNCpy(strerrbuf, strerror(errnum), buflen);
|
||||||
|
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_STRERROR_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_STRERROR_R)
|
||||||
pthread_mutex_unlock(&strerror_lock);
|
pthread_mutex_unlock(&strerror_lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -106,7 +106,7 @@ int
|
|||||||
pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
|
pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
|
||||||
size_t buflen, struct passwd **result)
|
size_t buflen, struct passwd **result)
|
||||||
{
|
{
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETPWUID_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETPWUID_R)
|
||||||
/*
|
/*
|
||||||
* Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
|
* Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
|
||||||
* getpwuid_r(uid, resultbuf, buffer, buflen)
|
* getpwuid_r(uid, resultbuf, buffer, buflen)
|
||||||
@ -117,7 +117,7 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
|
||||||
static pthread_mutex_t getpwuid_lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t getpwuid_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
pthread_mutex_lock(&getpwuid_lock);
|
pthread_mutex_lock(&getpwuid_lock);
|
||||||
#endif
|
#endif
|
||||||
@ -125,7 +125,7 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
|
|||||||
/* no getpwuid_r() available, just use getpwuid() */
|
/* no getpwuid_r() available, just use getpwuid() */
|
||||||
*result = getpwuid(uid);
|
*result = getpwuid(uid);
|
||||||
|
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
|
||||||
|
|
||||||
/* Use 'buffer' memory for storage of strings used by struct passwd */
|
/* Use 'buffer' memory for storage of strings used by struct passwd */
|
||||||
if (*result &&
|
if (*result &&
|
||||||
@ -181,7 +181,7 @@ pqGethostbyname(const char *name,
|
|||||||
struct hostent **result,
|
struct hostent **result,
|
||||||
int *herrno)
|
int *herrno)
|
||||||
{
|
{
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETHOSTBYNAME_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETHOSTBYNAME_R)
|
||||||
/*
|
/*
|
||||||
* broken (well early POSIX draft) gethostbyname_r() which returns
|
* broken (well early POSIX draft) gethostbyname_r() which returns
|
||||||
* 'struct hostent *'
|
* 'struct hostent *'
|
||||||
@ -191,7 +191,7 @@ pqGethostbyname(const char *name,
|
|||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
|
||||||
static pthread_mutex_t gethostbyname_lock = PTHREAD_MUTEX_INITIALIZER;
|
static pthread_mutex_t gethostbyname_lock = PTHREAD_MUTEX_INITIALIZER;
|
||||||
pthread_mutex_lock(&gethostbyname_lock);
|
pthread_mutex_lock(&gethostbyname_lock);
|
||||||
#endif
|
#endif
|
||||||
@ -199,7 +199,7 @@ pqGethostbyname(const char *name,
|
|||||||
/* no gethostbyname_r(), just use gethostbyname() */
|
/* no gethostbyname_r(), just use gethostbyname() */
|
||||||
*result = gethostbyname(name);
|
*result = gethostbyname(name);
|
||||||
|
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Use 'buffer' memory for storage of structures used by struct hostent.
|
* Use 'buffer' memory for storage of structures used by struct hostent.
|
||||||
@ -268,7 +268,7 @@ pqGethostbyname(const char *name,
|
|||||||
if (*result != NULL)
|
if (*result != NULL)
|
||||||
*herrno = h_errno;
|
*herrno = h_errno;
|
||||||
|
|
||||||
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
|
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
|
||||||
pthread_mutex_unlock(&gethostbyname_lock);
|
pthread_mutex_unlock(&gethostbyname_lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
|
||||||
* Portions Copyright (c) 1994, Regents of the University of California
|
* Portions Copyright (c) 1994, Regents of the University of California
|
||||||
*
|
*
|
||||||
* $Header: /cvsroot/pgsql/src/tools/thread/Attic/thread_test.c,v 1.3 2003/10/24 20:48:10 momjian Exp $
|
* $Header: /cvsroot/pgsql/src/tools/thread/Attic/thread_test.c,v 1.4 2003/11/24 13:16:22 petere Exp $
|
||||||
*
|
*
|
||||||
* This program tests to see if your standard libc functions use
|
* This program tests to see if your standard libc functions use
|
||||||
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
|
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
|
||||||
@ -21,7 +21,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_THREADS
|
#ifdef ENABLE_THREAD_SAFETY
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#endif
|
#endif
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user