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

Commit8878cc4

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 Perl5.6.1.
1 parent040e1ce commit8878cc4

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-
#defineUSE_THREADS 1
2912+
#defineENABLE_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/2418:36:38 petere Exp $ */
1+
/* $Header: /cvsroot/pgsql/src/interfaces/ecpg/ecpglib/connect.c,v 1.18 2003/11/2413:16:22 petere Exp $ */
22

33
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
55

6-
#ifdefUSE_THREADS
6+
#ifdefENABLE_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-
#ifdefUSE_THREADS
15+
#ifdefENABLE_THREAD_SAFETY
1616
staticpthread_mutex_tconnections_mutex=PTHREAD_MUTEX_INITIALIZER;
1717
#endif
1818
staticstructconnection*all_connections=NULL;
@@ -45,13 +45,13 @@ ECPGget_connection(const char *connection_name)
4545
{
4646
structconnection*ret=NULL;
4747

48-
#ifdefUSE_THREADS
48+
#ifdefENABLE_THREAD_SAFETY
4949
pthread_mutex_lock(&connections_mutex);
5050
#endif
5151

5252
ret=ecpg_get_connection_nr(connection_name);
5353

54-
#ifdefUSE_THREADS
54+
#ifdefENABLE_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-
#ifdefUSE_THREADS
358+
#ifdefENABLE_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-
#ifdefUSE_THREADS
390+
#ifdefENABLE_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-
#ifdefUSE_THREADS
414+
#ifdefENABLE_THREAD_SAFETY
415415
pthread_mutex_unlock(&connections_mutex);
416416
#endif
417417

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

443-
#ifdefUSE_THREADS
443+
#ifdefENABLE_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-
#ifdefUSE_THREADS
464+
#ifdefENABLE_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-
#ifdefUSE_THREADS
473+
#ifdefENABLE_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
#definePOSTGRES_ECPG_INTERNAL
44
#include"postgres_fe.h"
55

66
#include<limits.h>
77
#include<unistd.h>
8-
#ifdefUSE_THREADS
8+
#ifdefENABLE_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-
#ifdefUSE_THREADS
58+
#ifdefENABLE_THREAD_SAFETY
5959
staticpthread_key_tsqlca_key;
6060
staticpthread_once_tsqlca_key_once=PTHREAD_ONCE_INIT;
6161

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

91-
#ifdefUSE_THREADS
91+
#ifdefENABLE_THREAD_SAFETY
9292
staticpthread_mutex_tdebug_mutex=PTHREAD_MUTEX_INITIALIZER;
9393
staticpthread_mutex_tdebug_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-
#ifdefUSE_THREADS
120+
#ifdefENABLE_THREAD_SAFETY
121121
staticvoid
122122
ecpg_sqlca_key_init(void)
123123
{
@@ -128,7 +128,7 @@ ecpg_sqlca_key_init(void)
128128
structsqlca_t*
129129
ECPGget_sqlca(void)
130130
{
131-
#ifdefUSE_THREADS
131+
#ifdefENABLE_THREAD_SAFETY
132132
structsqlca_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(intn,FILE*dbgs)
213213
{
214-
#ifdefUSE_THREADS
214+
#ifdefENABLE_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-
#ifdefUSE_THREADS
222+
#ifdefENABLE_THREAD_SAFETY
223223
pthread_mutex_unlock(&debug_init_mutex);
224224
#endif
225225
}
@@ -229,7 +229,7 @@ ECPGlog(const char *format,...)
229229
{
230230
va_listap;
231231

232-
#ifdefUSE_THREADS
232+
#ifdefENABLE_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-
#ifdefUSE_THREADS
242+
#ifdefENABLE_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-
#ifdefUSE_THREADS
258+
#ifdefENABLE_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(interrnum,char*strerrbuf,size_tbuflen)
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
returnstrerrbuf;
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
staticpthread_mutex_tstrerror_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_tuid,structpasswd*resultbuf,char*buffer,
107107
size_tbuflen,structpasswd**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
staticpthread_mutex_tgetpwuid_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
structhostent**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
staticpthread_mutex_tgethostbyname_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/2420:48:10 momjian Exp $
9+
*$Header: /cvsroot/pgsql/src/tools/thread/Attic/thread_test.c,v 1.4 2003/11/2413: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-
#ifdefUSE_THREADS
24+
#ifdefENABLE_THREAD_SAFETY
2525
#include<pthread.h>
2626
#endif
2727
#include<unistd.h>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp