Skip to content

Commit 8878cc4

Browse files
committed
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.
1 parent 040e1ce commit 8878cc4

File tree

7 files changed

+43
-43
lines changed

7 files changed

+43
-43
lines changed

configure

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2909,7 +2909,7 @@ if test "${enable_thread_safety+set}" = set; then
29092909
yes)
29102910

29112911
cat >>confdefs.h <<\_ACEOF
2912-
#define USE_THREADS 1
2912+
#define ENABLE_THREAD_SAFETY 1
29132913
_ACEOF
29142914

29152915
;;

configure.in

Lines changed: 2 additions & 2 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 $Header: /cvsroot/pgsql/configure.in,v 1.302 2003/11/03 14:42:08 tgl Exp $
2+
dnl $Header: /cvsroot/pgsql/configure.in,v 1.303 2003/11/24 13:16:22 petere Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -351,7 +351,7 @@ IFS=$ac_save_IFS
351351
#
352352
AC_MSG_CHECKING([allow thread-safe client libraries])
353353
PGAC_ARG_BOOL(enable, thread-safety, no, [ --enable-thread-safety make client libraries thread-safe],
354-
[AC_DEFINE([USE_THREADS], 1,
354+
[AC_DEFINE([ENABLE_THREAD_SAFETY], 1,
355355
[Define to 1 to build client libraries as thread-safe code. (--enable-thread-safety)])])
356356
AC_MSG_RESULT([$enable_thread_safety])
357357
AC_SUBST(enable_thread_safety)

src/include/pg_config.h.in

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
/* Define to 1 if you want National Language Support. (--enable-nls) */
4040
#undef ENABLE_NLS
4141

42+
/* Define to 1 to build client libraries as thread-safe code.
43+
(--enable-thread-safety) */
44+
#undef ENABLE_THREAD_SAFETY
45+
4246
/* Define to 1 if gettimeofday() takes only 1 argument. */
4347
#undef GETTIMEOFDAY_1ARG
4448

@@ -609,10 +613,6 @@
609613
/* Define to select SysV-style shared memory. */
610614
#undef USE_SYSV_SHARED_MEMORY
611615

612-
/* Define to 1 to build client libraries as thread-safe code.
613-
(--enable-thread-safety) */
614-
#undef USE_THREADS
615-
616616
/* Define to select unnamed POSIX semaphores. */
617617
#undef USE_UNNAMED_POSIX_SEMAPHORES
618618

src/interfaces/ecpg/ecpglib/connect.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.17 2003/08/24 18:36:38 petere Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.18 2003/11/24 13:16:22 petere Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
55

6-
#ifdef USE_THREADS
6+
#ifdef ENABLE_THREAD_SAFETY
77
#include <pthread.h>
88
#endif
99
#include "ecpgtype.h"
@@ -12,7 +12,7 @@
1212
#include "extern.h"
1313
#include "sqlca.h"
1414

15-
#ifdef USE_THREADS
15+
#ifdef ENABLE_THREAD_SAFETY
1616
static pthread_mutex_t connections_mutex = PTHREAD_MUTEX_INITIALIZER;
1717
#endif
1818
static struct connection *all_connections = NULL;
@@ -45,13 +45,13 @@ ECPGget_connection(const char *connection_name)
4545
{
4646
struct connection *ret = NULL;
4747

48-
#ifdef USE_THREADS
48+
#ifdef ENABLE_THREAD_SAFETY
4949
pthread_mutex_lock(&connections_mutex);
5050
#endif
5151

5252
ret = ecpg_get_connection_nr(connection_name);
5353

54-
#ifdef USE_THREADS
54+
#ifdef ENABLE_THREAD_SAFETY
5555
pthread_mutex_unlock(&connections_mutex);
5656
#endif
5757

@@ -355,7 +355,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
355355
realname = strdup(dbname);
356356

357357
/* add connection to our list */
358-
#ifdef USE_THREADS
358+
#ifdef ENABLE_THREAD_SAFETY
359359
pthread_mutex_lock(&connections_mutex);
360360
#endif
361361
if (connection_name != NULL)
@@ -387,7 +387,7 @@ ECPGconnect(int lineno, int c, const char *name, const char *user, const char *p
387387
char *db = realname ? realname : "<DEFAULT>";
388388

389389
ecpg_finish(this);
390-
#ifdef USE_THREADS
390+
#ifdef ENABLE_THREAD_SAFETY
391391
pthread_mutex_unlock(&connections_mutex);
392392
#endif
393393
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
411411
ECPGfree(dbname);
412412
return false;
413413
}
414-
#ifdef USE_THREADS
414+
#ifdef ENABLE_THREAD_SAFETY
415415
pthread_mutex_unlock(&connections_mutex);
416416
#endif
417417

@@ -440,7 +440,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
440440
struct sqlca_t *sqlca = ECPGget_sqlca();
441441
struct connection *con;
442442

443-
#ifdef USE_THREADS
443+
#ifdef ENABLE_THREAD_SAFETY
444444
pthread_mutex_lock(&connections_mutex);
445445
#endif
446446

@@ -461,7 +461,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
461461

462462
if (!ECPGinit(con, connection_name, lineno))
463463
{
464-
#ifdef USE_THREADS
464+
#ifdef ENABLE_THREAD_SAFETY
465465
pthread_mutex_unlock(&connections_mutex);
466466
#endif
467467
return (false);
@@ -470,7 +470,7 @@ ECPGdisconnect(int lineno, const char *connection_name)
470470
ecpg_finish(con);
471471
}
472472

473-
#ifdef USE_THREADS
473+
#ifdef ENABLE_THREAD_SAFETY
474474
pthread_mutex_unlock(&connections_mutex);
475475
#endif
476476

src/interfaces/ecpg/ecpglib/misc.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.16 2003/10/21 15:34:34 tgl Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/misc.c,v 1.17 2003/11/24 13:16:22 petere Exp $ */
22

33
#define POSTGRES_ECPG_INTERNAL
44
#include "postgres_fe.h"
55

66
#include <limits.h>
77
#include <unistd.h>
8-
#ifdef USE_THREADS
8+
#ifdef ENABLE_THREAD_SAFETY
99
#include <pthread.h>
1010
#endif
1111
#include "ecpgtype.h"
@@ -55,7 +55,7 @@ static struct sqlca_t sqlca_init =
5555
}
5656
};
5757

58-
#ifdef USE_THREADS
58+
#ifdef ENABLE_THREAD_SAFETY
5959
static pthread_key_t sqlca_key;
6060
static pthread_once_t sqlca_key_once = PTHREAD_ONCE_INIT;
6161

@@ -88,7 +88,7 @@ static struct sqlca_t sqlca =
8888
};
8989
#endif
9090

91-
#ifdef USE_THREADS
91+
#ifdef ENABLE_THREAD_SAFETY
9292
static pthread_mutex_t debug_mutex = PTHREAD_MUTEX_INITIALIZER;
9393
static pthread_mutex_t debug_init_mutex = PTHREAD_MUTEX_INITIALIZER;
9494
#endif
@@ -117,7 +117,7 @@ ECPGinit(const struct connection * con, const char *connection_name, const int l
117117
return (true);
118118
}
119119

120-
#ifdef USE_THREADS
120+
#ifdef ENABLE_THREAD_SAFETY
121121
static void
122122
ecpg_sqlca_key_init(void)
123123
{
@@ -128,7 +128,7 @@ ecpg_sqlca_key_init(void)
128128
struct sqlca_t *
129129
ECPGget_sqlca(void)
130130
{
131-
#ifdef USE_THREADS
131+
#ifdef ENABLE_THREAD_SAFETY
132132
struct sqlca_t *sqlca;
133133

134134
pthread_once(&sqlca_key_once, ecpg_sqlca_key_init);
@@ -211,15 +211,15 @@ ECPGtrans(int lineno, const char *connection_name, const char *transaction)
211211
void
212212
ECPGdebug(int n, FILE *dbgs)
213213
{
214-
#ifdef USE_THREADS
214+
#ifdef ENABLE_THREAD_SAFETY
215215
pthread_mutex_lock(&debug_init_mutex);
216216
#endif
217217

218218
simple_debug = n;
219219
debugstream = dbgs;
220220
ECPGlog("ECPGdebug: set to %d\n", simple_debug);
221221

222-
#ifdef USE_THREADS
222+
#ifdef ENABLE_THREAD_SAFETY
223223
pthread_mutex_unlock(&debug_init_mutex);
224224
#endif
225225
}
@@ -229,7 +229,7 @@ ECPGlog(const char *format,...)
229229
{
230230
va_list ap;
231231

232-
#ifdef USE_THREADS
232+
#ifdef ENABLE_THREAD_SAFETY
233233
pthread_mutex_lock(&debug_mutex);
234234
#endif
235235

@@ -239,7 +239,7 @@ ECPGlog(const char *format,...)
239239

240240
if (f == NULL)
241241
{
242-
#ifdef USE_THREADS
242+
#ifdef ENABLE_THREAD_SAFETY
243243
pthread_mutex_unlock(&debug_mutex);
244244
#endif
245245
return;
@@ -255,7 +255,7 @@ ECPGlog(const char *format,...)
255255
ECPGfree(f);
256256
}
257257

258-
#ifdef USE_THREADS
258+
#ifdef ENABLE_THREAD_SAFETY
259259
pthread_mutex_unlock(&debug_mutex);
260260
#endif
261261
}

src/port/thread.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
99
*
10-
* $Id: thread.c,v 1.12 2003/10/26 04:29:15 momjian Exp $
10+
* $Id: thread.c,v 1.13 2003/11/24 13:16:22 petere Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -21,7 +21,7 @@
2121
#else
2222
#include <pwd.h>
2323
#endif
24-
#if defined(USE_THREADS)
24+
#if defined(ENABLE_THREAD_SAFETY)
2525
#include <pthread.h>
2626
#endif
2727

@@ -73,23 +73,23 @@
7373
char *
7474
pqStrerror(int errnum, char *strerrbuf, size_t buflen)
7575
{
76-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_STRERROR_R)
76+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_STRERROR_R)
7777
/* reentrant strerror_r is available */
7878
/* some early standards had strerror_r returning char * */
7979
strerror_r(errnum, strerrbuf, buflen);
8080
return strerrbuf;
8181

8282
#else
8383

84-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_STRERROR_R)
84+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_STRERROR_R)
8585
static pthread_mutex_t strerror_lock = PTHREAD_MUTEX_INITIALIZER;
8686
pthread_mutex_lock(&strerror_lock);
8787
#endif
8888

8989
/* no strerror_r() available, just use strerror */
9090
StrNCpy(strerrbuf, strerror(errnum), buflen);
9191

92-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_STRERROR_R)
92+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_STRERROR_R)
9393
pthread_mutex_unlock(&strerror_lock);
9494
#endif
9595

@@ -106,7 +106,7 @@ int
106106
pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
107107
size_t buflen, struct passwd **result)
108108
{
109-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETPWUID_R)
109+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETPWUID_R)
110110
/*
111111
* Early POSIX draft of getpwuid_r() returns 'struct passwd *'.
112112
* getpwuid_r(uid, resultbuf, buffer, buflen)
@@ -117,15 +117,15 @@ pqGetpwuid(uid_t uid, struct passwd *resultbuf, char *buffer,
117117

118118
#else
119119

120-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
120+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
121121
static pthread_mutex_t getpwuid_lock = PTHREAD_MUTEX_INITIALIZER;
122122
pthread_mutex_lock(&getpwuid_lock);
123123
#endif
124124

125125
/* no getpwuid_r() available, just use getpwuid() */
126126
*result = getpwuid(uid);
127127

128-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
128+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETPWUID_R)
129129

130130
/* Use 'buffer' memory for storage of strings used by struct passwd */
131131
if (*result &&
@@ -181,7 +181,7 @@ pqGethostbyname(const char *name,
181181
struct hostent **result,
182182
int *herrno)
183183
{
184-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETHOSTBYNAME_R)
184+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && defined(HAVE_GETHOSTBYNAME_R)
185185
/*
186186
* broken (well early POSIX draft) gethostbyname_r() which returns
187187
* 'struct hostent *'
@@ -191,15 +191,15 @@ pqGethostbyname(const char *name,
191191

192192
#else
193193

194-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
194+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
195195
static pthread_mutex_t gethostbyname_lock = PTHREAD_MUTEX_INITIALIZER;
196196
pthread_mutex_lock(&gethostbyname_lock);
197197
#endif
198198

199199
/* no gethostbyname_r(), just use gethostbyname() */
200200
*result = gethostbyname(name);
201201

202-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
202+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
203203

204204
/*
205205
* Use 'buffer' memory for storage of structures used by struct hostent.
@@ -268,7 +268,7 @@ pqGethostbyname(const char *name,
268268
if (*result != NULL)
269269
*herrno = h_errno;
270270

271-
#if defined(FRONTEND) && defined(USE_THREADS) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
271+
#if defined(FRONTEND) && defined(ENABLE_THREAD_SAFETY) && defined(NEED_REENTRANT_FUNCS) && !defined(HAVE_GETHOSTBYNAME_R)
272272
pthread_mutex_unlock(&gethostbyname_lock);
273273
#endif
274274

src/tools/thread/thread_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $Header: /cvsroot/pgsql/src/tools/thread/Attic/thread_test.c,v 1.3 2003/10/24 20:48:10 momjian Exp $
9+
* $Header: /cvsroot/pgsql/src/tools/thread/Attic/thread_test.c,v 1.4 2003/11/24 13:16:22 petere Exp $
1010
*
1111
* This program tests to see if your standard libc functions use
1212
* pthread_setspecific()/pthread_getspecific() to be thread-safe.
@@ -21,7 +21,7 @@
2121
*/
2222

2323

24-
#ifdef USE_THREADS
24+
#ifdef ENABLE_THREAD_SAFETY
2525
#include <pthread.h>
2626
#endif
2727
#include <unistd.h>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy