1
0
mirror of https://github.com/postgres/postgres.git synced 2025-08-27 07:42:10 +03:00

Rename USE_THREADS to ENABLE_THREAD_SAFETY to avoid name clash with Perl.

Fixes compliation failure with --enable-thread-safety --with-perl and Perl
5.6.1.
This commit is contained in:
Peter Eisentraut
2003-11-24 13:11:27 +00:00
parent a62f62d78b
commit 83ab17e051
7 changed files with 43 additions and 43 deletions

View File

@@ -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.17.2.1 2003/11/24 13:11:27 petere Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
#include <pthread.h>
#endif
#include "ecpgtype.h"
@@ -12,7 +12,7 @@
#include "extern.h"
#include "sqlca.h"
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
static pthread_mutex_t connections_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
static struct connection *all_connections = NULL;
@@ -45,13 +45,13 @@ ECPGget_connection(const char *connection_name)
{
struct connection *ret = NULL;
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&connections_mutex);
#endif
ret = ecpg_get_connection_nr(connection_name);
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&connections_mutex);
#endif
@@ -355,7 +355,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
realname = strdup(dbname);
/* add connection to our list */
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&connections_mutex);
#endif
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>";
ecpg_finish(this);
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&connections_mutex);
#endif
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);
return false;
}
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&connections_mutex);
#endif
@@ -440,7 +440,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
struct sqlca_t *sqlca = ECPGget_sqlca();
struct connection *con;
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&connections_mutex);
#endif
@@ -461,7 +461,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
if (!ECPGinit(con, connection_name, lineno))
{
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&connections_mutex);
#endif
return (false);
@@ -470,7 +470,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
ecpg_finish(con);
}
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&connections_mutex);
#endif

View File

@@ -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.16.2.1 2003/11/24 13:11:27 petere Exp $ */
#define POSTGRES_ECPG_INTERNAL
#include "postgres_fe.h"
#include <limits.h>
#include <unistd.h>
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
#include <pthread.h>
#endif
#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_once_t sqlca_key_once = PTHREAD_ONCE_INIT;
@@ -88,7 +88,7 @@ static struct sqlca_t sqlca =
};
#endif
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER;
static pthread_mutex_t debug_init_mutex = PTHREAD_MUTEX_INITIALIZER;
#endif
@@ -117,7 +117,7 @@ ECPGinit(const struct connection * con, const char *connection_name, const int l
return (true);
}
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
static void
ecpg_sqlca_key_init(void)
{
@@ -128,7 +128,7 @@ ecpg_sqlca_key_init(void)
struct sqlca_t *
ECPGget_sqlca(void)
{
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
struct sqlca_t *sqlca;
pthread_once(&sqlca_key_once, ecpg_sqlca_key_init);
@@ -211,7 +211,7 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
void
ECPGdebug(int n, FILE *dbgs)
{
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&debug_init_mutex);
#endif
@@ -219,7 +219,7 @@ ECPGdebug(int n, FILE *dbgs)
debugstream = dbgs;
ECPGlog("ECPGdebug: set to %d\n", simple_debug);
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&debug_init_mutex);
#endif
}
@@ -229,7 +229,7 @@ ECPGlog(const char *format,...)
{
va_list ap;
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_lock(&debug_mutex);
#endif
@@ -239,7 +239,7 @@ ECPGlog(const char *format,...)
if (f == NULL)
{
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&debug_mutex);
#endif
return;
@@ -255,7 +255,7 @@ ECPGlog(const char *format,...)
ECPGfree(f);
}
#ifdef USE_THREADS
#ifdef ENABLE_THREAD_SAFETY
pthread_mutex_unlock(&debug_mutex);
#endif
}